TextRecognitionDataGenerator icon indicating copy to clipboard operation
TextRecognitionDataGenerator copied to clipboard

Can I set the background img size when I'm using "-b 3"?

Open xmyhhh opened this issue 4 years ago • 9 comments

For example, the background image size is 512 * 512, while the font on the background image is 15px. Thanks~

xmyhhh avatar Apr 28 '20 15:04 xmyhhh

It is not currently possible to do that, but I can see how it could be a valuable feature for some users.

Can you provide some samples of what the end result would look like? I can probably add it quickly.

Belval avatar Apr 28 '20 15:04 Belval

It's like subtitles in a movie or TV. (eg. https://wx1.sbimg.cn/2020/04/28/_20200428231825.jpg) ,I am doing this for video Text recognition training.

I want to generate picture with different font (size and color) on it. (eg. https://wx2.sbimg.cn/2020/04/28/DSC_262.png)

thanks for your quick reply~

xmyhhh avatar Apr 28 '20 15:04 xmyhhh

Both your links are unavailable to me for some reason.

I'll try something and you can tell me if it fits your usecase.

Belval avatar Apr 28 '20 16:04 Belval

I've uploaded the image to my GitHub repository https://github.com/xmyhhh/raspi-checkin-client/blob/master/20200428231825.jpg https://github.com/xmyhhh/raspi-checkin-client/blob/master/DSC_262.png

Your code is very readable, I have roughly understood your code flow, and I think I can make appropriate modifications to meet my needs. When I'm done, I'll tell you , Thanks~

xmyhhh avatar Apr 28 '20 17:04 xmyhhh

@Belval Hey I have similar requirements. Let me put it again. The flags which control the final size of the image when using background-image are mainly,

  • size
  • width
  • margin apart from orientation and alignment.

I feel there should be flags instead like text size, final image width, final image height, location in terms of (x,y) coordinates or percentage from origin to put text which will make it easier to put the text.

I like your code, but could you add instructions to compile it locally to run and edit for my requirements or could you help me with these requirements.

thenamangoyal avatar May 18 '20 15:05 thenamangoyal

It's been a recurring request since the new module format that made it harder to have a development version, I'll had steps on how to clone and run the project.

Your explanations also help, I will look into it on my side, but I am incredibly busy due to an internship so I do not know when I'll be able to ship the feature.

Belval avatar May 18 '20 23:05 Belval

nice work, but it would be nice to have the added features that are mentioned in this thread.

tpham3783 avatar Apr 05 '22 14:04 tpham3783

@tpham3783

The truth is that everyone's needs are not quite the same. I suggest you fork the project and make your own changes, the author's code is very readable and you only need to spend a little time modifying it to meet your needs.

I also modified one myself to achieve the effect. More specifically, I use a JSON file to configure the style I want to generate, maybe it can give you some Inspiration. My code link here and the style JSON file here

xmyhhh avatar Apr 05 '22 14:04 xmyhhh

thanks,

I forked the code and added a feature to generate objects instead of texts. Sizing of the output image is also possible. It is on my branch at

https://github.com/tpham3783/TextRecognitionDataGenerator

tpham3783 avatar Apr 12 '22 14:04 tpham3783