Reputation: 75
two or more images have the same image size such as 512X512 pixels I would like to create a new image that selecting the pixels of lowest intensity from these images, for example, the new image get the pixel (1,1) from image 1, pixel (1,2) from image2, pixel (512,512)from image 3, because the intensity of these pixels are the lowest in the comparison of all the open images. Is there any simple code like below? Thanks a lot for your help!
My attempt:
image img1, img2, img3, newimg
img1=getfrontimage()
hideimage(img1)
img2=getfrontimage()
hideimage(img2)
img3=getfrontimage()
showimage(img1)
showimage(img2)
newimag:=min(img1,img2,img3)
showimage(newimg)
Upvotes: 0
Views: 101
Reputation: 2949
You were super-close with your solution already. The command you are seeking is called minimum
. It gives the (respective) minimum from an arbirtray list of expressions. You can also use scalar values as a parameter:
image img1 := realImage("1",4,100,100)
image img2 := realImage("2",4,100,180)
image img3 := realImage("3",4,100,100)
img1 = icol
img2 = irow
img3 = iradius
image img4 := minimum(img1,img2,img3,30)
img4.ShowImage()
The minimum()
command is all you need for your example, but keep in mind that you can always "build up" whatever you need with a sequence of tert() commands as well. F.e. the following would do exactly the same:
image img4 = img1
img4 = img2 < img4 ? img2 : img4
img4 = img3 < img4 ? img3 : img4
img4 = 30 < img4 ? 30 : img4
Upvotes: 0