Closed hsl323 closed 2 years ago
Hi,
The text instances do not disappear after the generation of each 'image'. That's why you see the text. Though the first generated image would not have text if you take a look at it.
You can:
(1) remove/comment line 147-169
(2) when you run python3 run_generation.py --UnrealProjectName $SceneName --languages Latin
, add a flag --MaxTextNum =0
Thanks for your answering I can extract no-text images.
but i want extract pair of text image and no-text image that have same background.
I thing if I can control random environments for two runs with and without text, it would be possible to extract the pair image.
Can I control random environments to be the same for two runs? or is there an easier way?
Currently, control over camera/environment randomness is not supported. There is one workaround:
There is one step to generate some text regions and write their paths to a txt file. This file will be read by the game executive. You can also take a look by yourself what this file is like during generation. https://github.com/Jyouhou/UnrealText/blob/dc8460a8dff37c61d5bf290b013674bb0c42d429/code/DataGenerator/TextPlacingModule.py#L167
So the workaround is like this:
(1). First, you prepare an empty img: all 4 RGBA channels are zeros.
(2) In def _GenerateOneImageInstance
, after all the steps, you write a dummy word_img_paths.txt. The first line is an int, the number of text instance, which you can determine from the output of step 4. Then the followings lines are the same path to the empty img.
(3) After (2), all the text instances are changed to transparent texture so no text is visible.
(4) Take a shot by self.client.SaveImg(img_path)
but probably you need to change the img_path.
I tried to extract image before placing text in the scene by adding self.cleint.SaveImg before 'step 3: place text' in DataGeneratorModule.py
but text already exists in the extracted scene
is it possible extract a scene that is the same as the generated image but has no text??