emscripten-core / emscripten-core/emscripten
Build c++ script with opencv issue
- Vorherrschende Sprache
- C++
- Sterne
- 27.6k
- Forks
- 3.6k
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 125
Beschreibung
hi there
this is my cpp script :
`
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
Mat src;
extern "C" {
int version(uint8_t *buf, uint8_t *target, int bufLen)
{
uint8_t* newBuf = target;
int i;
float ratio[30] = {0};
float num = 29;
float step = 1/num;
for(int i=0; i<30;++i){
ratio[i] = i*step;
}
float **array;
array=new float*[121680];// 180*26*26
for(int i=0;i<121680;i++)
{
array[i]=new float[3];
memset(array[i],0,3*sizeof(float));
}
for(int i=0; i<30; i++){
array[i*676 + 675][0] = 1 - ratio[i];
array[i*676 + 675][1] = ratio[i];
array[i*676 + 675][2] = 0;
}
for(int i=30; i<60; i++){
array[i*676 + 675][0] = 0;
array[i*676 + 675][1] = 1 - ratio[i-30];
array[i*676 + 675][2] = ratio[i-30];
}
for(int i=60; i<90; i++){
array[i*676 + 675][0] = 0;
array[i*676 + 675][1] = ratio[i-60];
array[i*676 + 675][2] = 1 - ratio[i-60];
}
for(int i=90; i<120; i++){
array[i*676 + 675][0] = 0;
array[i*676 + 675][1] = 1 - ratio[i-90];
array[i*676 + 675][2] = ratio[i-90];
}
for(int i=120; i<150; i++){
array[i*676 + 675][0] = 0;
array[i*676 + 675][1] = ratio[i-120];
array[i*676 + 675][2] = 1 - ratio[i-120];
}
for(int i=150; i<180; i++){
array[i*676 + 675][0] = ratio[i-150];
array[i*676 + 675][1] = 1 - ratio[i-150];
array[i*676 + 675][2] = 0;
}
for(int i=24;i>=0;i--){
for(int j=0; j<180; j++){
array[676*j + 26*i + 25][0] = (array[j*676 + 675][0])*i/25.0;
array[676*j + 26*i + 25][1] = (array[j*676 + 675][1])*i/25.0 + (1 - i/25.0);
array[676*j + 26*i + 25][2] = (array[j*676 + 675][2])*i/25.0;
}
}
for(int i=24;i>=0;i--){
for(int j=25; j>=0; j--){
for(int k=0; k<180; k++){
array[k*676 + j*26 + i][0] = (array[k*676 + j*26 + 25][0])*i/25.0;
array[k*676 + j*26 + i][1] = (array[k*676 + j*26 + 25][1])*i/25.0;
array[k*676 + j*26 + i][2] = (array[k*676 + j*26 + 25][2])*i/25.0 +(1 - i/25.0);
}
}
}
vector vec_data(&buf[0], &buf[0] + bufLen);
src = imdecode(vec_data,1);
// ...
delete [] array;
return 1;
}
}
`
the problem is, it will give error like
`error: undefined symbol: _ZN2cv8fastFreeEPv
error: undefined symbol: _ZN2cv8imdecodeERKNS_11_InputArrayEi
Error: Aborting compilation due to previous errors
`
any clue how to link the missing library?
Beitragsleitfaden
Rechercherichtung
Das Issue enthält nur ein Inline-C++-Snippet und Linkerfehler; es nennt keinen Build-Befehl, keine Projektdateien, keinen OpenCV-Build und keinen Test-Einstiegspunkt. Beginne damit, den Emscripten-Link-Schritt zu reproduzieren und zu untersuchen, wie die OpenCV-Module bereitgestellt werden. Als erledigt gilt die Aufgabe, wenn die fehlenden Symbole aufgelöst werden und der gezeigte Quelltext erfolgreich gebaut wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, opencv, wasm
- Bereich
- build-system, computer-vision
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100