Message Boards Message Boards

0
|
3396 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How can I output an image after I riffle the imagedata?

Hi there anyone can help me with this: - After I change the values of the list a to a small image data in black and white and keep doing the same thing as I did to first program I am not able to get an image...Anyone can help me?

a={{0., 1., 0.}, {1., 0., 1.}, {0., 1., 0.},{0., 1., 0.}, {1., 0., 1.}, {0., 1., 0.},{0., 1., 0.}, {1., 0., 1.}, {0., 1., 0.}}
c=Flatten[a]
b=c
d=Riffle[b,c]
e=Partition[d,6]
Image[e]
Image[a]

Second program should do the same as the above for the image data but it gets me a weird result:

a=ImageData[ ]
c=Flatten[a]
b=c
d=Riffle[b,c]
e=Partition[d,6]
Image[e]
Image[a]

the image I want to get the image data from is attached...

4 Replies

I wanted to increase the density of the pixels so when you magnify it it doesn't blow out the image,if for every step,in between every magnification you increase the pixels referred to the new amplified image i think you could get a better image...i noticed that you can riffle it self but can you do it to the sides as well? Or rotate the image and riffle it self and then add up the image data?

Posted 2 years ago

Try writing code in a more functional form

a = {{0., 1., 0.}, {1., 0., 1.}, {0., 1., 0.}, {0., 1., 0.}, {1., 0., 1.}, {0., 1., 0.}, {0., 1., 0.}, {1., 0., 1.}, {0., 1., 0.}};
a // Flatten // Riffle[#, #] & // Partition[#, 6] & // Image
(* Same result *)

For the attached image

image=Import["https://community.wolfram.com//c/portal/getImageAttachment?filename=9a53b9d4650f4f8742bee3ed0cc6f822diamondblackandwhite.jpg&userId=1147177"]

imageData = ImageData@image;
3*Times @@ ImageDimensions@image
(* 215940 *)

When it is riffled with itself it is twice that long. Partition by 6 will result in a tall skinny image.

newImage = imageData // Flatten // Riffle[#, #] & // Partition[#, 6] & // Image;

ImageDimensions@newImage
(* {6, 71980} *)

What exactly are you trying to accomplish?

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Unable to reproduce

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract