I have a list of picture(Noting the ordering)
My target is get the 3D'image,Now I get the mask
of it like following(If you use it,you should Binarize
it by yourself)
Then
I can get the result by slices
Image3D[slices, BoxRatios -> {1, 1, 1}]
As you can see,the color transition of surface is so bad that you can see it clearly that it is made up of 4 pictures.For the smooth color transition we needs some sampled picture,then we use the Image3D
build 3D-image.So the question is how to resample a list of image.If the target is a list of number,we can use ArrayResample
like as:
In[1]:= ArrayResample[{1,2,3,4,5},9]
Out[1]= {1,3/2,2,5/2,3,7/2,4,9/2,5}
But the list is picture now.How to do it?Can Any body have a try?
Answer
You can use ImageResize
to resample the z-direction for your purpose.
imgs = Import /@ {
"http://i.stack.imgur.com/CXvgm.jpg",
"http://i.stack.imgur.com/RJJnL.jpg",
"http://i.stack.imgur.com/xdbmR.jpg",
"http://i.stack.imgur.com/auRS8.jpg"};
mask = Import["http://i.stack.imgur.com/6S4Vj.png"];
slices = ImageMultiply[#, mask] & /@ imgs;
With[{img3d = Image3D[slices]},
ImageResize[img3d, ImageDimensions[img3d]*{1, 1, 100},
Resampling -> "Linear"]
]
With this, you get a smooth transition. You probably won't need 100 slices, so please adapt the resampling size and the even the Resampling
method as you like.
Comments
Post a Comment