How to identify a black dot in an RGB Image programmatically and then select a region in rectangle shape nearby to the black dot present in Image?

조회 수: 1 (최근 30일)
Hi, I want to select a particular region shown in red line with reference to point in the image(shown in black dot). Please refer the attached image.
Kindly Suggest a method to do the same using MATLAB. I need to find out that black spot in the image programmatically and then select the region based on that point present in the image. The selected region can be in the shape of rectangle.
  댓글 수: 4
Jan
Jan 2018년 1월 22일
@Ananthu Jayan: Again I have removed your flag. Please stop using flags to catch attraction of readers, because this is not the purpose of flags. Thanks.
I think, you do not get an answer, because this is not clear: "Can I programmatically find the position of the black spot". You did not mention, how the position of the black spot is defined. Then it is impossible to find it by an algorithm.
Explain, what you want to do. Which region do you want to select by which method?
Guillaume
Guillaume 2018년 1월 22일
편집: Guillaume 2018년 1월 22일
With the test image provided, finding the location of the black dot is trivial. That begs the question: why aren't you able to do it yourself? What is the difficulty?
With regards to the region selection, what is the criteria for the size of that region? Is it a user input (again, trivial to do) or is it based on the size of the leaf? (a bit harder but not that hard) or something else?

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

답변 (1개)

Utkarsh Deshmukh
Utkarsh Deshmukh 2018년 1월 16일
Try this
img = imread('img.png');
reference_point = [450, 450];
region_height = 200;
region_width = 400;
cropped_region = img(reference_point(1): reference_point(1)+region_height, reference_point(2): reference_point(2)+region_width, :);
by changing the reference point, you can change the top left coordinate. By changing the region_eidth and region_height, you can change the size of the region that you want to crop
  댓글 수: 3
Jan
Jan 2018년 1월 17일
This means that your image is smaller than the selected rectangle. Of course you have to adjust the values of Utkarsh Deshmukh's answer.
Ananthu Jayan
Ananthu Jayan 2018년 1월 18일
I have attached the image above for testing. Can I programmatically find the position of the black spot in the image and then select a region accordingly.

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by