grayscale with color indices not matching up
Mostra commenti meno recenti
im currently working on a grayscale picture with color save by ginput. Im having issues with my left indices not being the same size with the right. Can someone help me out
RGB = imread('bird.jpg');
hsvImage=rgb2hsv(RGB);
imshow(RGB)
[x, y] = ginput(1);
row = round(y);
column = round(x);
%Average Hue
AH = hsvImage(row,column, 1);
%input tolerance
TOL=AH*.1;
%Tolerance minimum
MinH=AH-AH*TOL/100;
%Tolerance max
MaxH=AH+AH*TOL/100;
[row,column]=size(RGB);
for i=1:row
for j=1:column
if (hsvImage(i,j,1)>=MinH)||(hsvImage(i,j,1)<=MaxH)
newimage(i,j,1)=RGB(:,:,1);
newimage(i,j,1)=RGB(:,:,2);
newimage(i,j,1)=RGB(:,:,3);
else
newimage(i,j,1) = (RGB(:,:,1)* 0.2989 + RGB(:,:,2)* 0.5870 + ...
RGB(:,:,3)*0.1140 );
newimage(:,:,2) = newimage(:,:,1);
newimage(:,:,3) = newimage(:,:,1);
end
end
end
Risposte (1)
Image Analyst
il 29 Apr 2021
No, do not do this:
[row,column]=size(RGB);
do this instead:
[row, column, numberOfColorChannels] = size(RGB);
Why? See Steve's blog:
2 Commenti
luke schneider
il 29 Apr 2021
Image Analyst
il 30 Apr 2021
I could explain it, if you explain it first. Like did you use impixel()?
Categorie
Scopri di più su Image Data Acquisition in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!