Bus error when converting colors
I get a bus error that I cannot figure out. It crashes in this section of the code when it tries to convert the color. It is in visionpipeline.cpp
cv::cvtColor(input, out, cv::COLOR_BGR2HLS); This is the line where it stops and I get a bus error
Here is a github link to all the code: https://github.com/isaiahwalton/Jetso...
that's not enough information. please add the exact errormsg.
also, the code you show isn't helpful to diagnose anything here.
Ok I revised my post to give a link to my github repository.
i'm afraid, noone here will get a jetson TK AND clone your github, to reproduce the error.
Ok sorry. Forgive me as I am a mom who has been thrust into the position of programming mentor and I’m helping out my 15-year-old son who is been thrust into the position of head programmer for world championship robotics team. I have a little to no experience and we are drinking through the fire hose of C++ and are now drinking from the firehose of vision processing. Forgot that you would have to clone it from github. This error has stumped us for a few days. It might be a byte alignment issue.
@cwalton, don't get it wrong, you got all my sympathy, i'm only stumped, at how to make this "reproducable"
Ha ha I wasn’t thinking about anybody actually trying to duplicate it I thought somebody might just take a look at the code and see if they could see something off hand that we have done wrong.
Ok we ran gdb debugging and got this error:
Program received signal SIGBUS, Bus error. 0x0000b5d2 in __gnu_cxx::__exchanged_and_add (__mem=0x2, __val=-1) at /usr/include/c++/4.8/ext/atomicity.h:49 49 { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
So it appears that the data type is not byte aligned. We ran some code to determine if was aligned and it said it wasn’t. Problem is that we don’t know how to align it in the CV::mat class. When we change it to a local variable it works, but of course we can’t have that. Any help you can give would be hugely appreciated. We are completely stuck,
well, i had a quick look at your code, and found, that you are passing around pointers to cv::Mat, e.g.here
don't do that ! cv::Mat is already a refcounted smartpointer around the pixels, if you use pointers to that , you defeat it's purpose, and inevitably have aliases, dangling dead pointers and memleaks.
use a plain copy (it's only 60 or so bytes) or a reference instead, NOT pointers.
please also do NOT use IplImages or anything from the defunkt C-api
and well, to outsource the whole gstreamer capture code & "hack some tiny things in" -- that's at least "exotic"
can you reproduce it with a simple minimal prog, that just loads a cv::Mat from disk, and convert it to hls ? next step might be, to feed it through your whole processing pipeline.
again, my guess is, you're doing something invalid in the capture part.
Hmmm..... all the code in visionpipeline was auto generated by GRIP