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 visualizzazioni (ultimi 30 giorni)
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 Commenti
Jan
Jan il 22 Gen 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 il 22 Gen 2018
Modificato: Guillaume il 22 Gen 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?

Accedi per commentare.

Risposte (1)

Utkarsh Deshmukh
Utkarsh Deshmukh il 16 Gen 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 Commenti
Jan
Jan il 17 Gen 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 il 18 Gen 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.

Accedi per commentare.

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by