I am trying to use a for loop to read 4 images (of the format 1.jpg,2.jpg etc...) and then calculate the value and location of the minimum pixel of each image. Below is the code I have so far:
RGB=cell(1,4); for i=1:4 RGB{i}=imread(sprintf('%d.jpg',i)); %Converting the image in to a RGB matrix gray{i}=rgb2gray(RGB{i}); %Converting the RGB image to grayscale gray_double{i}=double(gray{i}); %Changing from uint8 format to double Min_pixel{i}=min(gray_double{i}(:)); %Finding the minimum pixel value [row, column] = find(gray_double == Min_pixel,1);%Finding location of first minimum end;
The code works up until Line 8 where it struggles to obtain the minimum pixel value. Is there an easier way to do this?
RGB=cell(4,1); gray=cell(4,1); Min_loc=cell(4,1); for i=1:4 RGB{i}=imread(sprintf('%d.jpg',i)); gray{i}=rgb2gray(RGB{i}); % Convert the RGB image to grayscale [Min_pixel{i},i_loc]=min(gray{i}(:)); % Find the minimum pixel value, location of first [r,c]=ind2sub(size(gray{i}),i_loc); % Convert linear index to row, column Min_loc{i}=[r,c]; % return to cell array for image end
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.