POV-Ray : Newsgroups : povray.binaries.images : Synthetic data sets for image analysis : Re: Synthetic data sets for image analysis Server Time
26 Apr 2024 00:14:21 EDT (-0400)
  Re: Synthetic data sets for image analysis  
From: Mike Horvath
Date: 19 Feb 2019 00:30:00
Message: <5c6b9458$1@news.povray.org>
On 1/27/2019 1:14 PM, Alain wrote:
> Le 19-01-27 à 01:43, BayashiPascal a écrit :
>> Hi everyone,
>>
>> I came up a few days ago with some (maybe?) unconventional way to use 
>> POV-Ray
>> for my job and would like to introduce it here in case it would be of any
>> interest to someone else.
>> I was looking for data sets of images to test machine learning 
>> algorithms and
>> couldn't find any one that fit my needs. Then I started thinking of 
>> how I could
>> generate automatically my own data sets. Of course, speaking of synthesis
>> picture, I immediately thought of POV-Ray, and it worked perfectly for 
>> me.
>> The problem here is not that much the generation of the image itself, 
>> but the
>> generation of its mask. For example, in the example pictures below, 
>> the target
>> is the cube, so I needed to generate automatically the image of the 
>> cube *and*
>> its duplicate where every pixels matching the cube are black and all 
>> the others
>> are white. I found that I could achieve this using the two textures 
>> below, one
>> for the target, and one for everything else.
>>
>> #declare _texMaskTarget = texture {
>>    pigment { color Black }
>>    finish { ambient 0 }
>> }
>> #declare _texMaskNonTarget = texture {
>>    pigment { color White }
>>    finish { ambient 1 diffuse 100 }
>> }
>>
>> Crafting the scene to my needs, adding randomness on the desired variable
>> components of the scene, using the clock variable as the seed for the 
>> random
>> generator, wrapping that in a Python script which generates and 
>> executes an INI
>> file including the directive Declare=Mask=0 to switch between the 
>> normal texture
>> and the mask texture, and I had a very handy tool to generate in 
>> minutes a data
>> set of hundred of samples crafted to match perfectly any needed test 
>> case.
>>
>> If anyone has a better idea than my trick with the textures to 
>> generate the mask
>> I would be glad to hear it.
>>
>> For those interested, everything is available on GitHub here:
>> https://github.com/BayashiPascal/SDSIA
>>
>>
> 
> You can also use the quality setting.
> If you set the pigment of the box to rgb 0, the pigment of everything 
> else to rgb 1, and use +q0 on the command line, you'll get the same 
> result. The advantage is that it should be faster as no light are used.
> 
> When using +q0 the following happen :
> ALL light are ignored.
> EVERYTHING is rendered assuming full ambient only.
> Diffuse is ignored.
> There are no shadow.
> Radiosity is disabled.
> Reflections are ignored.
> 
> The quality setting can be set via an ini file or on the command line.

I wonder if this would work for video game shadow sprites too.


Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.