Skip to content

How can I use other OpenCV functions ? #1

@orgicus

Description

@orgicus

Hi,

I've successfully compiled a swc using the instructions provided.
At the moment I'm playing with other OpenCV functions.
I've swapped

#include "opencv/cv.h"

with

#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>

recompiled, all went fine.

Then added this:

void process(cv::Mat &image, int div=64) {
    //colorReduce
    int nl= image.rows; // number of lines
    int nc= image.cols * image.channels();
    for (int j=0; j<nl; j++) {
        uchar* data= image.ptr<uchar>(j);
        for (int i=0; i<nc; i++) {
            data[i]= data[i]/div*div + div/2;
        }
    }
}

above setFramePtr and in I'm calling it after the RGBA2GRAY
conversion passing in gs_frame

If I try to do f lip:

cv::flip(gs_frame,gs_frame,1);

The code compiles, but the rendering in flash is a bit scrambled (row/column order is a bit strange).

My main problem is when I try to call Canny or threshold.
The swc doesn't compile and I get this in Terminal:

g++ -swc -Wall -O3 -DOSX -I ../include/ -o camlib.swc ./o/*.o camlib.cpp 
WARNING: While resolving call to function 'main' arguments were dropped!
WARNING: While resolving call to function 'stub_null' arguments were dropped!
WARNING: While resolving call to function 'stub_zero' arguments were dropped!
WARNING: While resolving call to function 'stub_zero' arguments were dropped!
WARNING: While resolving call to function 'stub_zero' arguments were dropped!
WARNING: While resolving call to function 'stub_zero' arguments were dropped!
WARNING: While resolving call to function 'stub_zero' arguments were dropped!
Assertion failed: (TLI.isTypeLegal(VT) && "Intrinsic uses a non-legal type?"), function visitTargetIntrinsic, file /Volumes/data/dev/FlaCC/llvm-2.1/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 2465.
0   llc                                 0x00636dfe _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 6078
1   llc                                 0x006373a2 _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 7522
2   libSystem.B.dylib                   0x92ff705b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libSystem.B.dylib                   0x930845a5 raise + 26
5   libSystem.B.dylib                   0x9309a6e4 abort + 93
6   libSystem.B.dylib                   0x9308720f __assert_rtn + 252
7   llc                                 0x003f3e2a _ZN4llvm11StoreSDNodeD1Ev + 90026
8   llc                                 0x003f5256 _ZN4llvm11StoreSDNodeD1Ev + 95190
9   llc                                 0x003f817c _ZN4llvm11StoreSDNodeD1Ev + 107260
10  llc                                 0x0040bc68 _ZN4llvm11StoreSDNodeD1Ev + 187880
11  llc                                 0x0040d3f2 _ZN4llvm11StoreSDNodeD1Ev + 193906
12  llc                                 0x0040f92e _ZN4llvm11StoreSDNodeD1Ev + 203438
13  llc                                 0x005d1926 _ZN4llvm12FunctionPassD1Ev + 20998
14  llc                                 0x005d1f3a _ZN4llvm12FunctionPassD1Ev + 22554
15  llc                                 0x005d20c5 _ZN4llvm12FunctionPassD1Ev + 22949
16  llc                                 0x00002e44 0x0 + 11844
17  llc                                 0x00001f36 0x0 + 7990
18  ???                                 0x00000006 0x0 + 6

I have experience with actionscript, but am learning c++/opencv, so the above errors do
no help me understand what's wrong whatsoever :(

Also, on my machine, I have OpenCV 2.3.1 installed, but the .o files are generated from the code you supplied in the project.
Would that make any difference ?

Any hints/tips would help.

Thanks,
George

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions