How do I effectively search through a matrix that represents pixels of an image?

조회 수: 2 (최근 30일)
John
John 2018년 1월 23일
답변: Nicolas Schmit 2018년 1월 23일
I have an image that is read into a matrix using imread(). I would like to find these "corners" in the image.
For example,
255 255 255
255 0 0 255
255 0 0 255
The bold 0 would be a black top left corner which is surrounded by red(255).
Currently, I am doing a search that goes through each element in the matrix from top to bottom.
for i = 1:100
for j = 1:100
...
end
end
Is the any more efficient way to do this search? Could anyone tell me the name of the search
Thanks
  댓글 수: 2
KSSV
KSSV 2018년 1월 23일
YOu can convert the image into gray and see...how your values be..and then search..?
John
John 2018년 1월 23일
Sorry, I dont see how rgb2gray would help that much? I was thinking that i need a better searching method
Thank you

댓글을 달려면 로그인하십시오.

답변 (1개)

Nicolas Schmit
Nicolas Schmit 2018년 1월 23일
You could vectorize the inner loop using find()

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by