Filter löschen
Filter löschen

Indexing Error in Image Processing

1 Ansicht (letzte 30 Tage)
Jasmine Haraburda
Jasmine Haraburda am 9 Jul. 2018
Beantwortet: Ji Hoon Jeong am 3 Sep. 2018
My goal is to write code when a user clicks on an image and gets the linear index of where they clicked.
I keep getting an error saying "Linear indices cannot exceed the number of elements in the label matrix." My equation to find the linear index (when clicking a point on an image) is... linearindex = ((col-1) * y) + row; where col is clicked column. row is clicked row. y is the maximum number of rows (height) of the whole picture.
This is what I used to make the label matrix... (Label matrix = L) X = rgb2lab(RGB); L = superpixels(X,2450,'IsInputLab',true);
I don't understand why it's saying the sizes are different. Is it some small error like +-1 in my calculation of the linear index of the pixel matrix? Please helppp

Antworten (1)

Ji Hoon Jeong
Ji Hoon Jeong am 3 Sep. 2018
If you are trying to get the location of the pixel where a user clicked, then you better try ginput function.
ginput(1) will prompt the user to click on the image, then the output of the function will be X and Y coordinate of the image.

Kategorien

Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by