How to find a specific row and column RGB matrix
14 views (last 30 days)
Show older comments
Hello. I want to select a RGB matrix from one image (For example as rows-200 to 220 and coloumn 230to246 matrix) and want to find pixel location of same matrix in another image. For that I wrote below program.Here I1 is first image,I2 is second image and Irefmat is specific matrix from image I1 which I want to find in I2.
Irefmat=I1(100:120,100:120);
red=I2(:,:,1);
green=I2(:,:,2);
blue=I2(:,:,3);
mask=red == Irefmat
green == Irefmat
blue == Irefmat ;
[rows,columns]=find(mask);
subplot(2,2,1);
imshow(mask);
But error is coming. Looking forward for some help!!!
3 Comments
Constantino Carlos Reyes-Aldasoro
on 15 Apr 2021
IT would be easier to help if you illustrate your problem with actual images.
Accepted Answer
Image Analyst
on 16 Apr 2021
I do exactly that in my demo of normxcorr2(). I extract out a rectangular ROI (white onion) from an image (that contains the onion) and then find it in the image. I use the same image, but you could just as well find it in a different image.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!