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?

2 vues (au cours des 30 derniers jours)
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 commentaires
Jan
Jan le 22 Jan 2018
@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 le 22 Jan 2018
Modifié(e) : Guillaume le 22 Jan 2018
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?

Connectez-vous pour commenter.

Réponses (1)

Utkarsh Deshmukh
Utkarsh Deshmukh le 16 Jan 2018
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 commentaires
Jan
Jan le 17 Jan 2018
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 le 18 Jan 2018
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by