简体   繁体   English

信号 7 (SIGBUS),代码 1 (BUS_ADRALN),故障地址

[英]Signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr

I'm trying to do stitching on android.我正在尝试在 android 上进行拼接。 I used Surf algorithm to serve as finder and I got an error like "try enable OPENCV_ENABLED_NONFREE".我使用 Surf 算法作为查找器,但出现“尝试启用 OPENCV_ENABLED_NONFREE”之类的错误。 I use C++ native code on Android Studio and do stitching in background.我在 Android Studio 上使用 C++ 本机代码并在后台进行拼接。 I solved the surf error but now, when I test this application on real device, I get this error:我解决了冲浪错误,但现在,当我在真实设备上测试此应用程序时,我收到此错误:

错误

I did some research in another forum, and they say that the problem may be caused by a function that doesn't return the value it's supposed to return.我在另一个论坛上做了一些研究,他们说问题可能是由 function 引起的,它没有返回它应该返回的值。 Is there anyone who can help me please.请问有没有人可以帮助我。 This is the code:这是代码:

private Handler handler = new Handler(new Handler.Callback() {
    @Override
    public boolean handleMessage(Message message) {
        switch (message.what) {
            case HANDLER_START_STITCHING :
            {
                new Thread()
                {
                    public void run()
                    {
                        AsyncTask.execute(new Runnable() {
                            @Override
                            public void run() {
                                String[] source=getDirectoryFilelist("null");

                                final File resultDir = new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath() + File.separator + "viewwer");

                                // if (!resultDir.exists())
                                // resultDir.mkdir();

                                final String stitchingResultImagePath = new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath()) +"/result.jpg"; // + (ANGLE-90) + ".jpg";
                                if( NativePanorama.jniStitching(source, stitchingResultImagePath, STITCH_IMAGE_SCALE) == 0 )
                                {
                                    handler.sendMessage(handler.obtainMessage(HANDLER_SET_STITCHING_BUTTON_TEXT,"Stitching success"));

                                    File image = new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath());
                                    File result_90 =  new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath() + "/result90.jpg");
                                    File result_180 =  new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath() + "/result180.jpg");

                                    File result_270 =  new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath() + "/result270.jpg");
                                    File result_360 =  new File(getApplicationContext().getExternalFilesDir(null).getAbsolutePath() + "/result360.jpg");

                                    Log.d("GESTION_STITCHING", result_180.toString());

                                    /*if (ANGLE == 450) {
                                        handler.sendMessage(handler.obtainMessage(HANDLER_FINISH_STITCHING,"Stitching success"));
                                    }*/

                                    if (image.exists()) {
                                        File[] files = image.listFiles();
                                        for (int i=0;i<files.length; i++) {
                                            if (files[i].compareTo(result_90) == 0 || files[i].compareTo(result_180) == 0 || files[i].compareTo(result_270) == 0 || files[i].compareTo(result_360) == 0) {

                                            } else {
                                                 files[i].delete();
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    handler.sendMessage(handler.obtainMessage(HANDLER_SET_STITCHING_BUTTON_TEXT,"Stitching error"));
                                }
                            }
                        });
                    }
                }.start();
                break;
            }

and the following is the native C++ code:以下是本机 C++ 代码:

JNIEXPORT jint JNICALL Java_com_priscilla_viewwer_utils_NativePanorama_jniStitching(JNIEnv *env, jclass clazz, jobjectArray source, jstring result, jdouble scale) {

clock_t beginTime, endTime;
double timeSpent;
beginTime = clock();
//init jni call java method

int i = 0;
bool try_use_gpu = true;
vector<Mat> imgs;
Mat img;
Mat img_scaled;
Mat pano;
Mat pano_tocut;
Mat gray;

const char* result_name = env->GetStringUTFChars(result, JNI_FALSE);  //convert result
LOGE("result_name=%s",result_name);
LOGE("scale=%f",scale);
int imgCount = env->GetArrayLength(source); //img count
LOGE("source imgCount=%d",imgCount);
for(i=0;i<imgCount;i++)
{
    jstring jsource = (jstring)(env->GetObjectArrayElement(source, i));
    const char* source_name = env->GetStringUTFChars(jsource, JNI_FALSE);  //convert jsource
    LOGE("Add index %d source_name=:%s", i, source_name);
    img=imread(source_name);
    Size dsize = Size((int)(img.cols*scale),(int)(img.rows*scale));
    img_scaled = Mat(dsize,CV_32S);
    resize(img,img_scaled,dsize);
    imgs.push_back(img_scaled);
    env->ReleaseStringUTFChars(jsource, source_name);  //release convert jsource
}
img.release();

pano = stitchingImages(imgs);
for(i=0;i<imgs.size();i++)
{
    imgs[i].release();
}

//cut black edges
//LOGE("stitching success,cutting black....");
pano_tocut = pano;
cvtColor(pano_tocut, gray, CV_BGR2GRAY);
Rect startROI(0,0,gray.cols,gray.rows); // start as the source image - ROI is the complete SRC-Image
cropLargestPossibleROI(gray,pano_tocut,startROI);
gray.release();

imwrite(result_name, pano_tocut);
pano.release();
pano_tocut.release();
env->ReleaseStringUTFChars(result, result_name);  //release convert result
endTime = clock();
timeSpent = (double)(endTime - beginTime) / CLOCKS_PER_SEC;
LOGE("success,total cost time %f seconds",timeSpent);
// env->CallVoidMethod(clazz, javaMethodRef, timeSpent);
return 0;
}

I came cross this issues either, and I found it was violating strict aliasing .我也遇到过这个问题,我发现它违反了严格的别名

cause by casting~铸造造成的~

problem:问题:

uint32_t i32 = *((uint32_t*)m_data);

solution:解决方案:

uint32_t i32 = 0;
char* p = (char*)&i32;
for(int i =0;i < 4;i++)
{
    p[i] = m_data[i];
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android RenderScript信号7(SIGBUS),代码1(BUS_ADRALN),故障加法器0x76f458b4 Adreno 306、320 - Android RenderScript signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x76f458b4 Adreno 306, 320 安装缓存时,Apache Ignite bus_adraln错误 - Apache Ignite bus_adraln error during installation of cache Android Libgdx致命信号11(SIGSEGV),代码1,故障加法器0x0 - Android Libgdx Fatal signal 11(SIGSEGV) ,code 1, fault addr 0x0 java.lang.Error:信号11(SIGSEGV),代码10(?),故障加法器006e006f - java.lang.Error: signal 11 (SIGSEGV), code 10 (?), fault addr 006e006f TID 13934中的致命信号11(SIGSEGV),代码1,故障加法器0x40 - Fatal signal 11 (SIGSEGV), code 1, fault addr 0x40 in tid 13934 Android 致命信号 11 (SIGSEGV),代码 1,tid 29092 中的故障地址 0x0 - Android Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 29092 如何摆脱错误“致命信号 11 (SIGSEGV),代码 1,故障地址 0x70” - How to get rid of the error “Fatal signal 11 (SIGSEGV), code 1, fault addr 0x70” TID 7061(GLThread 42829)中的致命信号11(SIGSEGV),代码1,故障加法器0x28 - Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 7061 (GLThread 42829) A/libc:添加 mircroblink 许可证文件时,致命信号 11 (SIGSEGV),代码 1,tid 27503 中的故障地址 0x7d400300 - A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7d400300 in tid 27503 when adding mircroblink license file A/libc:致命信号 11 (SIGSEGV),代码 1 (SEGV_MAPERR),tid 8890 (RenderThread) 中的故障地址 0x20,pid 8833 - A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 8890 (RenderThread), pid 8833
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM