bacardi55 / pimaton

A customizable photo booth application for Raspberry Pi
GNU General Public License v3.0
2 stars 4 forks source link

Clarification of Various Resolutions in YAML File Causing Border Calculation Errors #10

Open rwmccoy opened 6 years ago

rwmccoy commented 6 years ago

I am setting up Pimaton for a wedding and having trouble with the various resolutions in the configuration YAML file. When I change them, I get border calculation errors. I'm also unclear on where the various resolutions come into play.

settings:,resolution seems clear for the camera but also affects the image size on the screen. I'm using a 800 x 480 touch screen but I'd like the camera to take full-res pictures to store in the file system. Is there a way to specify a smaller size screen image while taking a full-res image?

image:, print_pic: is about the "generated image" size. Is this the size of the image that we will print vs the actual size of the saved file? So far, anything I've changed it to from the default file's 1241 x 1754 gives border errors. This section also has the rows and columns specification but anything I've tried other than the default rows: 3 cols: 2 gives an error. I'm am not using a template but, if I understand correctly I'll have to get a configuration that works before I can use the generate-template command. My plan is to use a thermal receipt printer to give guests quick feedback on their pictures and the URL where they will be able to find all of the photobooth images. For this, I'd like to have 1 column so the image can span the whole width of the paper and 6 rows for 5 images and the QRcode.

The thumbnails: section also has a resolution which causes the border calculation error any time I change it. Where does thumbnail resolution come into play and what are the rules to prevent border calculation errors?

Basically, any help with how these various resolutions relate and how they have to be specified to avoid calculation errors would be greatly appreciated. From looking at the issues, I may be the first one to actually use your program at a wedding. My niece is getting married next weekend (May 12) and I hope to have this available for her. However, I'm leaving for the venue tomorrow afternoon (May 8) and will have limited internet capability once there. So, I'm hoping to get the configuration right today or tomorrow morning. I'll have to build the enclosure once I'm there. :)

At any rate, thank you for a great program. I only thought of having a photobooth last Thursday and your work is the only thing that might make it possibile. All the other photobooth programs I found for the Pi pale in comparison. I look forward to how you refine it going forward.

bacardi55 commented 6 years ago

Hi,

I'm sorry but being away without my RPI until tomorrow late afternoon makes it difficult for me to help you as much as I'd like… But if you find an Internet connection at the venue, I'll be happy to help more.

picamera → settings → resolutions: This will change the resolution of the picture taken by the picamera and shouldn't impact anything else.

I'm using a 800 x 480 touch screen but I'd like the camera to take full-res pictures to store in the file system. Is there a way to specify a smaller size screen image while taking a full-res image?

Here I'm guessing you are using the GUI, correct? The GUI is using a fullscreen approach, so it shouldn't matter what screen you have.

From the picamera doc, preview is always fullscreen so it shouldn't get bigger than your sreensize… That being said, to make sure of it I'll need to test it on my rpi…

Images → print_pic → width / height: This is used for the final (the one that will be printed) image dimension Look here to see all the calculus of dimensions: https://github.com/bacardi55/pimaton/blob/master/pimaton/PimatonImage.py#L78 You can also use --debug to see the calculated dimensions (ans also see the result of the position for each thumbnails, that are calculated here.

I'm am not using a template but, if I understand correctly I'll have to get a configuration that works before I can use the generate-template command

True, make it works "blank" first and then generate a template file :)

For this, I'd like to have 1 column so the image can span the whole width of the paper and 6 rows for 5 images and the QRcode.

I haven't tried only 1 columns, but this should be feasible … My advice is look at the code i link above and try to do the calculus yourself (or use debug to make pimaton print them for you :)).

The thumbnails: section also has a resolution which causes the border calculation error any time I change it. Where does thumbnail resolution come into play and what are the rules to prevent border calculation errors?

Thumbnails is almost the most important for the print. It is the size of the thumbnails in the final generated image. The final image is the global image that contains X thumbnails (and optionally a QR code). So thumbnails size is the size of each image on the final image. Now that I'm typing this, I guess I could have made it calculated automatically based on final size image… but that's not how it is yet, so clearly you do want to play with this :). Look above in the code again to see how it is used :)

At any rate, thank you for a great program. I only thought of having a photobooth last Thursday and your work is the only thing that might make it possibile. All the other photobooth programs I found for the Pi pale in comparison. I look forward to how you refine it going forward.

Thanks for the nice comment, always nice to read :)

rwmccoy commented 6 years ago

Thank you! That should be everything I need to figure it out. I appreciate the offer of additional help if I have internet. I have my fingers crossed but would like to figure it out myself.

Looking at my specific application, small touch screen, thermal printer with thumbnails and a QRcode for the full size images, there are couple enhancements I would like. You'll have to decide if they make sense to you or if they won't be of general interest. I would be glad to write up either or both of these issues if you'd like me to.

Thank you again!

bacardi55 commented 6 years ago

Slideshow of previously taken images when booth is not in use to help entice people to step up and make their own pictures.

I thought about that, but I think it makes more sens to use a screensaver to do it… I did plan initially to develop it but why redo something that the desktop environment like Pixel on raspbian can do out of the box :)

(Is there already an?) Option to size QRcode on printed output. I'm using a URL shortener so I only need QRcode size 1. This makes it barely scannable on the two-up receipt printer format but it also makes it smaller. I'd like the QRcode to be the same size as the images no matter what code size it is.

There is the image → print_pic → qr_code_size option here that allow to change QR code size.

It takes the place of a thumbnails, so pimaton will calculate the top left corner for the QR code like it would be for the 6th thumbnail (or whatever number you have). So you can play with this option but make sure it can be scanned by a phone afterwards (I think I remember that size 1 could not be scanned on my phone).

The size is the "version" option of this python QR code library so it clearly impact the size

I haven't planned (yet?) to automate the "qr_code_size" value based on the thumbnail width/height value and not sure if I will (I may, but after a l ot of more important features :))

rwmccoy commented 6 years ago

Got it. I found the size one code was readable where the size 7 was not due to the decreased complexity, even though it was physically smaller. I'll play with that.

Screen saver. Of course, why make it hard or reinvent the wheel. Request withdrawn.

Yes! These are all lower priority. I'm excited about the GPIO addition you're working on now. My Big Red Button™ won't make it to this weekend's wedding but I have another in January and I'm sure it will be there.

rwmccoy commented 6 years ago

OK, with the block of code you pointed me to, I was able to get the one column print working. I've got some tuning to do but one thing is happening that I can't explain. The last line(s) of the QRcode are printing as garbage. I've tried code size 1 and 7 with the same results. I've tried lengthening and shortening the size of the print with no change in the problem. I've attached an image of the problem. Any ideas? photo may 07 5 23 40 pm

bacardi55 commented 6 years ago

That's an interesting one .. ^^ can u tell me if the generated image also have this or is it only when printing that it prints this weird last line ? (To understand if the issue is around qr code generation or printing)

Does the qr code works anyway when scanned or not really ?

rwmccoy commented 6 years ago

In the generated image the qr code is just truncated without the noise afterward that we see on the print. No, unfortunately, the code doesn't work. There's not enough of it.

I've attached my yaml file (zipped for github) in case that helps locating the problem. default_config_fullp.yaml.zip

bacardi55 commented 6 years ago

I'll try to run this config when i'll get home this afternoon to see what is happening..

even with a smaller qr code size it is truncated ?

rwmccoy commented 6 years ago

Yes, same deal with a size 1 code.

Looks like I'll be leaving about 1:00pm ET. I'm enjoying working with Pimaton but I've decided to give up on using it this weekend. I'm officiating so I'll have a lot to do once I get there. I'm going to pick it back up as soon as I get back since I see a lot of use for having one and plan a nice enclosure to make it easy to grab it and go.

Thanks for everything so far and I look forward to seeing Pimaton develop.

ukoofred commented 6 years ago

@rwmccoy Can you share the generated image? Maybe try with 100 px more for the ticket lenght. This kind of error are sometimes dues to uncomplete prints. Your config seems short : 6 row with 496px height pictures (with one row for the QR code) will give 100px margin and could be a little bit short.

rwmccoy commented 6 years ago

Thanks for the idea. I'll try it when I get back assuming @bacardi55 hasn't already solved it.

Unfortunately, I've already put away my prototype as I'm about to walk out the door to go to the wedding venue. I'm hoping for internet access there but it's a maybe. If I seem to disappear for the next 11 days, I'm just where the 'net don't shine. :)

bacardi55 commented 6 years ago

So I've played a bit with it. It seems that the QR code generated has blank space around the QR code itself and it needs more space than thought. That being said, I think your config is too limited for the "height" of the generated image.

I managed to make your config work by changing the QR code size to 1 (scanned correctly) and changing the height of the generated picture to 1900.

I think code here can be improved around size of QR code (maybe by using the box_size option of the QR code library). I'm putting this in the todolist too as I think it is important!