I am developping a qt5 application on my raspberry pi on raspbian using cross compilation.
When I run it, I get a black screen trying display a Pop-up which is a QFrame.
I suppose that it cannot be positioned because I have error messages arriving at the beginning :
EGLFS: Unable to query physical screen size, defaulting to 100 dpi.
EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
EGLFS: Unable to query screen depth, defaulting to 32.
EGLFS: To override, set QT_QPA_EGLFS_DEPTH.
When I disable the QFrame, the application is launched in full-screen by default, whereas I didn't set it.
I tried to set these environment variables with :
int main(int argc, char *argv[])
{
QByteArray width = qgetenv("QT_QPA_EGLFS_PHYSICAL_WIDTH");
width.setNum(1920);
QByteArray height = qgetenv("QT_QPA_EGLFS_PHYSICAL_HEIGHT");
height.setNum(1080);
QApplication a(argc, argv);
MainWindow w;
w.show();
w.launchGame();
return a.exec();
}
But the error messages are still displayed.
The main window is a QWidget and I defined his size using :
setFixedSize(1280, 720);
My question is, how to set these variables correctly or do you have another solution ?
Raspberry Pi 3 Kernel 4.14.27-v7+
Qt 5.10.1 cross-compiled from Ubuntu 16.04 host
I had to add the following to my .profile on my Rpi
Open .profile
sudo nano ~/.profile
I added these lines at end
# physical display properties
export QT_QPA_EGLFS_PHYSICAL_WIDTH=520
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=326
Then reload bash profile with (or reboot)
source .profile
The following link has descriptions for all the EGLFS environment variables:
http://doc.qt.io/qt-5/embedded-linux.html
I just put something like
export QT_QPA_EGLFS_PHYSICAL_WIDTH=myWidth
QT_QPA_EGLFS_PHYSICAL_HEIGHT=myHeight
QT_QPA_EGLFS_DEPTH=myDepth
in my .bashrc to get rid of those errors. Also the physical width and height are in millimeters not pixels, and screen depth is color depth of your display (18 in my case).
Related
When downloading images from the METEOR M-2 satellite, the image is compressed near the edges. This is corrected by a windows utility called SmoothMeteor. The problem with this app is that it's windows only, and doesn't seem to have a batch mode.
Is it possible to use ImageMagick to stretch an image only along the X axis, so that in the center there is no stretching, but the closer it is near the border, the more stretching is applied?
An example is provided here:
Notice how the center of the map is largely unaffected but the clouds near the left edge look about 4 times wider than the original.
I would guess this is like a pincushion transformation but only on the X axis, but I'm not sure if I'm even in the right track.
What is your platform? If on Unix-like (Linux, Mac OSX, Window 10 Unix or Windows w/Cygwin), then I have a bash shell script calling ImageMagick, called "xpand", that does what you ask. See my web site at http://www.fmwconcepts.com/imagemagick/index.php
Input:
xpand -d 350 -m horizontal img.png result.png
-d can be either a dimension or an aspect ratio (w:h). I note that my approach (a 2nd order stretch) seems to stretch the result a bit more than your SmoothMeteor tool.
I am doing something quite simple:
import -window root foo.png
This is supposed to capture the entire desktop - and it does... after a fashion. In fact, it captures everything except:
no desktop background - it remains black
it is "blind" to a maximized chrome. Unmaximizing it brings the contents into the screenshot
it displays black border around windows, which does not exist.
I am on
CentOS Linux release 7.4.1708 (Core)
X.Org X Server 1.19.3
ImageMagick 6.7.8-9 2016-06-16 Q16
Standard Screenshot capture utility works correctly - I am trying to figure out if I can fix the import tool setup for our test runs.
I'm developing a react native app that allows the user to take a photo (or choose one from the gallery) and automatically attaches it to an email. I'm using react-native-image-picker to select the image, which allows me to optimize the image in terms of
quality = 0 - 1
max-height = 1024
max-width = 1024
The resulting image is exactly what I want, either 1024x768 (landscape) or 768x1024 (portrait) and usually comes in under 100kb.
However, before sending the mail, the user is still presented with an image resize prompt. Since the image is already optimized, I would like to suppress (skip) this prompt. Is there anyway to bypass this prompt?
Furthermore, the prompt is inaccurate. The below image shows the prompt for an image that was pre-optimized to a size of 94kb. To email this full size, fully optimized image, the user must choose "Actual Size". Any other option resizes the image's dimensions and reduces the file size. As you can see, it inaccurately reports that "Actual Size" would be 674kb rather than the actual 94kb. So, if there's no way to suppress the prompt entirely, is it possible to make the size estimates more accurate?
UPDATE: An Insight
I noticed this option is not presented when attaching PNGs.
ImageMagick and RMagick both have a setting/attribute for "density", which is what they call resolution. I can pass it a value of 200 and it should set the resolution to 200x200 when the image is written to either a file or to_blob.
In the Rails console I can load the image, then set the density, and if I check it, it will tell me the density (originally 300x300) is now 200x200, but when I write it out to a file, the resolution is 300x300.
The only way I've successfully been able to change the resolution is by creating a new image of the same width and height, then overlay the original image. This, however, distorts the output, no matter what settings I use (I tried setting the original to fully opaque, the "new" to fully transparent, and even used the CopyCompositeOperation, which should fully replace the "new" image).
I have tried setting density like this:
image.density = "200"
And like this
image.write("test.jpg") {self.density="200"}
And both.
Nothing works... any ideas?
To be clear... I don't want to resize the image, I want to change the print resolution. I want the dimensions to remain the same (i.e. width/height should NOT change).
This was an issue with the version of ImageMagick that AWS has in its repositories. Removing that version and installing from source made the density setting work. Also, if you want the resolution change to be reflected in Windows applications, you need to strip the "8bim" profile from the image:
image.profile!("8bim",nil)
I capture some image data from a HD cam using OpenCV and this code (relevant snippets only):
data->capture =cvCaptureFromCAM(data->config.device); // open the device
...
IplImage *grabFrame=cvQueryFrame(data->capture);
Using this code I always get a grabFrame with a size of 640x480 while the camera supports 1920x1080. When I do something like that after initialisation:
cvSetCaptureProperty(data->capture,CV_CAP_PROP_FRAME_WIDTH,1920);
cvSetCaptureProperty(data->capture,CV_CAP_PROP_FRAME_HEIGHT,1080);
I get results in real HD resolution - but blurred images, means it is only upscaled from 640x480 to HD resolution. So: how can I force OpenCV to really use the fill native resolution?
It does not seem to be a driver/HW problem since it happens on Windows and Linux - and when I try any other application on these systems I get the full, native resolution as expected.
Thanks!
1. From (old) opencv C documentation :
The function cvSetCaptureProperty() sets the specified property of video capturing.
Currently the function supports only video files: CV_CAP_PROP_POS_MSEC, CV_CAP_PROP_POS_FRAMES, CV_CAP_PROP_POS_AVI_RATIO.
2. You can try to compile opencv with openNI since VideoCapture class make use of it for setting capture device options.
It helped me:
static const int MAX_WIDTH_RESOLUTION = 7680;
static const int MAX_HEIGHT_RESOLUTION = 4800;
cvCreateCameraCapture(...);
cvSetCaptureProperty(pCam, CV_CAP_PROP_FRAME_WIDTH, MAX_WIDTH_RESOLUTION);
cvSetCaptureProperty(pCam, CV_CAP_PROP_FRAME_HEIGHT, MAX_HEIGHT_RESOLUTION);
cvQueryFrame(...);
With two different webcams i've got 1900x1080 and 1280x960 frames.