Open 1369455660 opened 2 years ago
Well hello, you can use POV-Ray's internal animation tool to produce extensive data sets automatically. First, you must create init file with animation clock enabled, and then use it as variable:
object {Model
Rotate_Around_Trans(< 0, 360*clock, 0>,
< 4, 0, 1>)
texture {
pigment { color rgb<1, 1, 1> }
finish {reflection {0.9} ambient 0 diffuse 0.00005 specular 0.9 roughness 0.005}
} }
However, the modified POV-Ray will output the raw data always as "Contributions.txt", and thus over writing the previous file. I solved this problem by adding a script to automatically rename the previous file before a new one was created.
The Auer's original MATLAB repo: https://github.com/StefanJAuer/RaySAR/releases/tag/1.2 includes compiled POV-Ray and his theses with extensive documentation. You may also check my detailed project documentation here: https://www.rasmus-haapaniemi.com/portfolio/atr and also find my thesis about the topic.
And btw, the reflection coefficients are pretty aspect angle sensitive, and thus must be recalibrated for every change. You could created well working model for example 20 and 40 degrees, and then just rotate those along the z axis.
BR, Rasmus
Thank you for your kind reply. I added the Clock variable as you suggested, which does the job of automatically rotating the model. As you said, the "Contributions.txt" file is overwritten every time it is output. The way I know from the RaySAR Google Groups is to add the index or clock variable to the text file and then recompile Pov-Ray, see: https://groups.google.com/g/raysar/c/zZrEZhJsxBg. But I failed to recompile the Pov-Ray with VS2012. Can you share your automation rename script to me?
Yeah, I also figured out that solutions, however, I also was unable to recompile the POV-Ray after the modifications...
Anyway, this does the job perfectly well, although its not that beatufull solution:
import os
folder = "C:/Users/pov-ray-location"
i = 1
while True:
for file in os.listdir(folder):
if file == "Contributions.txt":
'''
The file is created before it is saved,
thus, accessing it too early will cause an error
'''
try:
source = folder + file
print(source)
destination = folder + str(i) + "_" + file
print(destination)
os.rename(source, destination)
i += 1
except:
print("\nIn use")
Yeah, I also figured out that solutions, however, I also was unable to recompile the POV-Ray after the modifications...
Anyway, this does the job perfectly well, although its not that beatufull solution:
import os folder = "C:/Users/pov-ray-location" i = 1 while True: for file in os.listdir(folder): if file == "Contributions.txt": ''' The file is created before it is saved, thus, accessing it too early will cause an error ''' try: source = folder + file print(source) destination = folder + str(i) + "_" + file print(destination) os.rename(source, destination) i += 1 except: print("\nIn use")
Thanks for your kind sharing, your script works great. I have one more question.
When I use the script to simulate a SAR image, the image always produces "stripes" like this:
I know it might have something to do with the pixel spacing settings in POV-Ray, but I can't tune those
parameters well, Do you have any good suggestions?
Thank you for making this script open source.I am trying to generate a dataset to be used in a machine learning task.What I want to do is to automatically iterate through several aspect angles and object rotation/translation parameters and generate corresponding 2D reflection mapsforagivenPOV/3D model.What should be the easiest way to write a script that can do this?Can you share your work in recompiling POV-Ray for RaySAR?