Arm architecture opencv qt not working properly
-
I'm trying to run my assignment on nano jetson, in doing so, i need to install opencv and qt, everything work fine (there's errors, still i manage to fix it all), after i run, the widget window open, but when i click in the button (on that widget) to open the image, nothing happended, i suspect i've done something wrong in the installing procedure, here's what i've done, please notify me if you see s.t suspicious:
- i download opencv5.1.1 from git, extract it
- install cmake and qt creator
- configure cmake, i select native compiler, choose gcc++: aarch64-linux-gnu-g++, gcc: aarch64-linux-gnu-g++
basically, i've done exactly like this tutorial https://www.youtube.com/watch?v=qA46fvP3O5A&t=197s
my code:
i add these in .pro file:
#INCLUDEPATH += "usr/local/include/opencv4"
LIBS +=pkg-config --libs opencv4
i add this function to mainwindow.cpp
void MainWindow::on_pushButton_clicked()
{
cv::Mat test_image = cf::imread("test_img.jpg",0);if(!test_image.data) { QMesaageBox msg; msg.setText("could not load image"); msg.exe(); } cv::namedWindow("test image", cv::WINDOW_AUTOSIZE); cv::imshow("test image", test_image);
}
the image is in my project folder
the code doesn't give out any error, but when i hitton the show image button, it just didn't work. i'm devastated
-
@NoobDude12343 said in Arm architecture opencv qt not working properly:
LIB += pkg-config --libs opencv4
It is
LIBS
notLIB
Do you include the right headers?
-
sorry, my bad, it's a typo @Pl45m4 i believe i include the right headers
-
Hi,
@NoobDude12343 said in Arm architecture opencv qt not working properly:
the image is in my project folder
But your binary is not(for good reasons) and you are using a relative path for your file. Either copy the image beside your executable or use a QFileDialog to retrieve the path to the image.
-
@SGaist pardon my slow-ness, but how can i copy the image beside my executable? and i get the path to my image by going diretly to that folder and open it in terminal, doing so, it will reveal my directory path, thus, i copied it. Am i mistaking something? thanks for your time
-
No no, just use cp to copy your image from its current folder to where your executable is built.
-
@SGaist i did just that, still nothing happended... perhap the problem lied somewhere else?
-
In your code add some checks to ensure that the file is there.
Maybe a silly question but, did you copy the file on your target ?
-
thanks dude, i figure it out. Still coudn't open the image after click the button, but i when i tried other code, it worked. overall i have achieved my code to test whether or not qt opencv worked on my jetson
-
What did you implement to make it work ?