Hi all,
I am having a bit of trouble scaling an image using ImageJ. I have 2 images of the same object, both 512 x 512, however one image is in effect taken from closer to the object, so the total scale is 350mmx350mm, the second image is in effect taken from further away and it's scale is 500mmx500mm. I would like to find a way of scaling (or maybe it is even a case of zooming) so that the 350mmx350mm image will overlap perfectly onto the 500mmx500mm image, however it is very important that the image remains 512x512 pixels. There is possibly a really easy solution to this, however so far all my attempts have resulted in the number of pixels changing. I really appreciate any help you could give me. Many thanks, Dave Lines |
Hi Dave,
Try this: You want to overlay the smaller sized image on the bigger one. The 350x350 mm image covers a smaller central portion of the larger image, so this image needs to decrease in size and then be fitted to 512x512 pixels with blank space around so it can overlay on 500x500 mm image. The scaling factor between your two images is 0.7 (350/500). Use the Image->Scale function to decrease the size of the 350x350 mm image using this factor (allow the number of pixels to decrease to 358x358 pixels and use interpolation). Now select all on the new image (Edit->Selection->Select All) and choose Edit->Cut. Create a new blank 512x512 image (File->New Image). Click Edit->paste and your 358x358 pixel image will be pasted in the centre of this new blank 512x512 image. Use the image threshold commands to set the pixel value of the blank areas to NaN. Now you can overlay this image onto the original 512x512 500x500mm image. You might have to shift one image relative to the other a bit to get a perfect overlay (Use Image->Translate or some other ImageJ plugin that looks for optimum overlay). John Oreopoulos On 29-May-09, at 6:43 AM, davelines wrote: > Hi all, > > I am having a bit of trouble scaling an image using ImageJ. > > I have 2 images of the same object, both 512 x 512, however one > image is in > effect taken from closer to the object, so the total scale is > 350mmx350mm, > the second image is in effect taken from further away and it's > scale is > 500mmx500mm. > > I would like to find a way of scaling (or maybe it is even a case of > zooming) so that the 350mmx350mm image will overlap perfectly onto the > 500mmx500mm image, however it is very important that the image remains > 512x512 pixels. > > There is possibly a really easy solution to this, however so far > all my > attempts have resulted in the number of pixels changing. > > I really appreciate any help you could give me. > > Many thanks, > > Dave Lines > -- > View this message in context: http://n2.nabble.com/Scaling-an-image- > without-changing-number-of-pixels-tp2993200p2993200.html > Sent from the ImageJ mailing list archive at Nabble.com. |
In reply to this post by davelines
Hi Dave,
if the scale is known to you and all you want is just applying it, then 1. scale by 350/500 or 500/350 2. change the canvas size to 512x512 If your images show really the same or a very similar looking object, in Fiji, there is a plugin that uses SIFT features for automatic alignment in presence of scale disparity. Make a stack from your images and call "Plugins -> Registration -> Linear Stack Alignment with SIFT", select "Similarity" as transformation and press OK. Alternatively, on both independently opened images, use one of the plugins under "Plugins -> Feature Extraction" to identify landmark correspondences (or click some manually) and then "Plugins -> Transform -> Landmark Correspondences". Again, "Similarity" is the transformation that includes isotropic scale. Best regards, Stephan On Fri, 2009-05-29 at 03:43 -0700, davelines wrote: > Hi all, > > I am having a bit of trouble scaling an image using ImageJ. > > I have 2 images of the same object, both 512 x 512, however one image is in > effect taken from closer to the object, so the total scale is 350mmx350mm, > the second image is in effect taken from further away and it's scale is > 500mmx500mm. > > I would like to find a way of scaling (or maybe it is even a case of > zooming) so that the 350mmx350mm image will overlap perfectly onto the > 500mmx500mm image, however it is very important that the image remains > 512x512 pixels. > > There is possibly a really easy solution to this, however so far all my > attempts have resulted in the number of pixels changing. > > I really appreciate any help you could give me. > > Many thanks, > > Dave Lines |
Free forum by Nabble | Edit this page |