I have an image and I would like to retrieve all color values of pixels which are located along stribes:
So what I do, is the following:
- I import the image from the web
- I get the image dimensions (w,h)
- I choose the number of stribes (rows) -> here:4
- I chose the number of pixels to examine for each row
- Using a nested table I can get a nested list of the color values
Here is the code:
im = Import[
"https://images.pexels.com/photos/67636/rose-blue-flower-rose-\
blooms-67636.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260"];
imD = ImageDimensions[im];
(*Width and Height*)
w = imD[[1]];
h = imD[[2]];
(*Input*)
numberOfRows = 4;
numberOfPixelsPerRow = 50;
(*Calculation*)
incrementX = Round[w/(numberOfPixelsPerRow-1)];
incrementY = Round[h/(numberOfRows-1)];
horizontal =
Table[
Table[
PixelValue[im, {x, y}], {x, 0, imD[[1]], incrementX}],
{y, 0, imD[[2]], incrementY}];
Now, I would like to visualize the color values in such a way:
A half transparent image of the original image, and only the retrieved pixels are not half transparent.
How can I do that ?