How Can we use PixelValue with pixel indices?
Asked
Active
Viewed 271 times
0
1 Answers
0
getPixelValue[img_, {x_, y_}] := PixelValue[img, {x , ImageDimensions[img][[2]]+1-y}]
phdstudent
- 423
- 3
- 12
-
1If this answer solves your problem, that's good. But why do you want to introduce another coordinate system? There are already three... If
xis supposed to be a column index from 1 to width andya row index from 1 to height, then your formula should bePixelValue[img, {x, height + 1 - y}]. You may want to check out the section "Coordinate Systems" from this tutorial (http://reference.wolfram.com/mathematica/tutorial/ImageProcessing.html). – Matthias Odisio Jan 08 '14 at 04:09 -
@MatthiasOdisio, sorry I forget just to add 1 to
ImageDimensions[img][[2]]+1-y– phdstudent Jan 08 '14 at 04:16
PixelValue? – rm -rf Jan 07 '14 at 22:03getPixelValue[img_, {x_, y_}] := PixelValue[img, {First@ImageDimensions[img] - y, x}]– C. E. Jan 07 '14 at 22:12getPixelValue[img_, {x_, y_}] := PixelValue[img, {First@ImageDimensions[img] - y, x}]is not correct and you have to correct like thisgetPixelValue[img_, {x_, y_}] := PixelValue[img, {x , ImageDimensions[img][[2]]-y}]– phdstudent Jan 07 '14 at 22:29