Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I have create a set of random locations and then at each location I place an object to simualte an image.
The delta just makes sure no objects are within 3 pixels of the image edge.
I know want to be able to change the locations now to represent the following regular pattern. I believe horizontallt there is a pitch of 8 pixels, and vertically a pitch of 9 pixels with a horiztonal shift of 4 pixels.
Thnaks for any help
Jason
Solved! Go to Solution.
Use the built-in convol2d function and the edge effect goes away (i could probably get it to go away using FTs as well, but the built-in function is a lot easier!).
Thanks Richard - its a while since we last spoke on this forum!!
Please see the attached, you helped me before a couple of years ago place a point spread function of random amplitude at each of these locations. I have tried to combine your previous work with this patterned location array and nearly have it, there's 3 issues that have arisen though and I'm not sure how to do them.
In particular:
1: How to count the number of objects, I tried the following but its not right.
2: How to apply random amplitudes to the objects using
amp=runif(n,0.1,1) - but how to then apply it to the objects in M?
3: How to get rid of the strange edge effect ont he right hand side
and lastly, how to allow for a random 0.5 pixel shift so that each psf is not necessarily centred exactly on a pixel.
Thanks
Jason
I've managed to answer my own questions, not sure if its the most elegant way. I included the randomw amplitude and object count in Richards original function.
Im still getting a strange edge effects on the RHS once its convolved with the psf.
Jason
Use the built-in convol2d function and the edge effect goes away (i could probably get it to go away using FTs as well, but the built-in function is a lot easier!).
Thansk Richard
Is it easy to modify this so the distance between the centres in x and y can be changed? i.e. I need a pitch of 6pixles in x, and 5 pixels in y.
Thanks
Jason
Sure. I was lazy, so this only has one pitch value, but you can easily modify it to have different pitches for x and y.
Thanks Richard. I think I've nearly done it, there just seems to be an issue of padding in the final array. Any suggestions please.
Thnaks
jason
Do you want to remove the bit at the bottom (i.e. the aspect ratio of the image will no longer be 1:1), or do you want to fill it with more pattern?
Yes remove the bit at the bottom, so no longer have aspect ratio of 1:1.
Thanks
Jason
Remove the first line of the program.