I am trying to executing cross compiled (for RISCV) sample c++ program.but i am getting error

asked 2018-07-27 00:07:25 -0500

updated 2018-07-27 00:22:34 -0500

berak gravatar image

I have cross compiled sample c++ program for riscv,and i am trying to executing in riscv-linux.Here riscv-linux there is now facility to display image as a result,so i am generating a result image matrix as a Text file and i am planing to see result in X86 architecture.but i am getting error before generating text file.

Makefile:-

CXX =riscv64-unknown-linux-gnu-g++
CXXFLAGS += -c -Wall $(shell pkg-config --cflags /home/billa/Downloads/opencv-3.4.2/platforms/linux/riscv_build/install/lib/pkgconfig/opencv.pc)
LDFLAGS += $(shell pkg-config --libs --static /home/billa/Downloads/opencv-3.4.2/platforms/linux/riscv_build/install/lib/pkgconfig/opencv.pc)
all: example
example: example.o; $(CXX) $< -o $@ $(LDFLAGS)
%.o: %.cpp; $(CXX) $< -o $@ $(CXXFLAGS)
clean: ; rm -f example.o example

Error: -

BusyBox v1.26.2 (2018-06-27 09:49:37 IST) built-in shell (ash)

# /opencv/example
/opencv/example
Built with OpenCV 3.4.2
VIDEOIO ERROR: V4L: can't open camera by index 0
No capture

My Sample c++ Program:

#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videoio.hpp"
#include <iostream>
#include <fstream>

using namespace cv;
using namespace std;

void drawText(Mat & image);

int main()
{
    cout << "Built with OpenCV " << CV_VERSION << endl;
    Mat image;
    VideoCapture capture;
    capture.open(0);
    if(capture.isOpened())
    {
        cout << "Capture is opened" << endl;
        for(;;)
        {
            capture >> image;
            if(image.empty())
                break;
            drawText(image);
            imshow("Sample", image);
            if(waitKey(10) >= 0)
                break;
        }
    }
    else
    {
        cout << "No capture" << endl;
        image = Mat::zeros(480, 640, CV_8UC1);
        drawText(image);
        //cout << image<<endl;
        //imshow("Sample", image);

FileStorage fs("myfile.txt",FileStorage::WRITE);
fs << "mat1" << image;

    return 0;
}
}


void drawText(Mat & image)
{
    putText(image, "Hello Welcome to RISCV OpenCV",
            Point(20, 50),
            FONT_HERSHEY_COMPLEX, 1, // font face and scale
            Scalar(255, 255, 255), // white
            1, LINE_AA); // line thickness and type
}
edit retag flag offensive close merge delete

Comments

Thanks your help me a lot..

Billa Surendra gravatar imageBilla Surendra ( 2018-08-07 04:45:27 -0500 )edit