1

I have writing a code in order to get pixel values of a image along a line. I want to repeatedly to apply the function to the image to get pixel values along multiple lines. My question is how can create such loop in mathematica.

IMGV1 = ImageValue[img, Table[{i, 1111}, {i, 300, 2451, 0.5}]];
IMGV2 = ImageValue[img, Table[{i, 1112}, {i, 300, 2451, 0.5}]];
IMGV3 = ImageValue[img, Table[{i, 1113}, {i, 300, 2451, 0.5}]];
IMGV4 = ImageValue[img, Table[{i, 1114}, {i, 300, 2451, 0.5}]];
IMGV5 = ImageValue[img, Table[{i, 1115}, {i, 300, 2451, 0.5}]];
IMGV6 = ImageValue[img, Table[{i, 1116}, {i, 300, 2451, 0.5}]];
Ji Daoyuan
  • 11
  • 2
  • 2
    It sounds highly unlikely that you'll do better than a built-in function. What exactly do you want to achieve, and how exactly do you need your output to look like? (Keep this in mind, by the way.) – Emilio Pisanty Aug 09 '16 at 13:21
  • Not sure I completely understand. Can't you just do {IMGV1,IMGV2,....}=Table[ImageValue[img,Table[{i,j}....]],{j,1111,...}]? – Feyre Aug 09 '16 at 13:25
  • @Feyre, Yes, you are right I can create multiple variables with iterated names and assign them with each tuple. – Ji Daoyuan Aug 09 '16 at 13:52
  • @Feyre. I would do Evaluate[Array[IMGV, 6]] = Table[ImageValue[img, Table[{i, j} ....]], {j, 1111, ...}] instead so that OP can indexed variables that can actually be operated on using Table, Map, etc. – march Aug 09 '16 at 15:39
  • The question is unclear. Are you asking how to generate the symbol names "IMGV1, .." in a loop? – george2079 Aug 09 '16 at 18:56

0 Answers0