Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

ReadingPicSetLabSet.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. %% Reading Pictures and Labels Sets
  2. % The function reads Pictures and Labels related to the pictures
  3. % from binary files in uint8 (unsigned int 8bits) format.
  4. % It provides also the possibility to Display the read pictures
  5. % in ordered arrangement, one for each diferent Label.
  6. %
  7. % Inputs:
  8. % - imgSz Size of the single squared picture
  9. % - N Total Number of pictures
  10. % - fileOffsetPic Offset for files containing pictures
  11. % - fileNamePic Name of the binary file containing pictures
  12. % - fileOffsetLab Offset for files containing labels
  13. % - fileNameLab Name of the binary file containing labels
  14. % - Display Flag for the visualization of the read pictures
  15. %
  16. % Outputs:
  17. % - XSet Vector containing the acquired pictures
  18. % - XLab Vector containing the acquired labels
  19. %
  20. % Dependencies:
  21. % - Xmat = Vector2Matrix(imgSz, N, XSet);
  22. %
  23. %%
  24. function [XSet, XLab]=ReadingPicSetLabSet(imgSz, N, fileOffsetPic, fileNamePic, fileOffsetLab, fileNameLab, Display)
  25. % Reading Binary Training Images
  26. fileIDPic = fopen(fileNamePic);
  27. XSet = fread(fileIDPic,imgSz^2*N+fileOffsetPic,'uint8');
  28. %XSet = uint8(XSet(fileOffsetPic+1:end));
  29. XSet = XSet(fileOffsetPic+1:end);
  30. fclose(fileIDPic);
  31. % Reading Binary Training Labels
  32. fileIDLab = fopen(fileNameLab);
  33. XLab = fread(fileIDLab,N+fileOffsetLab,'uint8');
  34. %XLab = uint8(XLab(fileOffsetLab+1:end));
  35. XLab = XLab(fileOffsetLab+1:end);
  36. fclose(fileIDLab);
  37. if(Display)
  38. % Building 3D matrix with N images
  39. Xmat = Vector2PictureMatrix(imgSz, N, XSet);
  40. % Showing images
  41. figure()
  42. suptitle('Ordered chosen pictures from the Training Data Set')
  43. for kk=1:10
  44. subplot(2, 5, kk)
  45. ind=find(XLab==kk-1,1,'first');
  46. imshow(255-Xmat(:,:,ind),[0 255])
  47. xlabel(int2str(XLab(ind)));
  48. end
  49. end
  50. end