Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

hi, i want to ask ntdll.dll eror in visual studio 2011. what should i do ?

$
0
0
"Unhandled exception at 0x00007FFA1067C4E0 (ntdll.dll) in ConsoleApplication13.exe: 0xC000007B: %hs is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support. Error status 0x." here's my program. the program succeed but when i ran, it happens. #include //#include #include "stdafx.h" #include #include #include #include #include #include #include #include //#include "stdafx.h"*/ #include #include using namespace cv; using namespace std; int threshold_value = 0; int threshold_type = 3; int const max_value = 255; int const max_type = 4; int const max_BINARY_value = 255; double RotateCount=0; int whitetot; char name[40]; int TotalPixel; int match_method; int max_Trackbar = 5; int gauss_ksize1 = 1; int gauss_ksize2 = 1; int const gauss_max_ksize1 = 11; int const gauss_max_ksize2 = 11; int throwtempX; int throwtempY; float persentemp; float persenhigh; Point MatchLocTemp; int i=0; int tempread=0; int gender; int degree; float JumlahPixelBeda=0; float JumlahPixelSama=0; float persentase=0; int filtervalue1 = 0; int filtervalue2 = 0; int filtervalue3 = 0; int filtervalue4 = 0; int maxvalue1=0; int maxvalue2=0; int maxvalue3=0; int maxvalue4=0; /** Function Headers */ char* ThreshWindow = "Threshold"; char* CropWindow = "GrayScale"; char* GaussWindow = "Gaussian"; char* result_window = "Result window"; char* templ_image = "template"; Mat image, gray_image, binary, ThrowImage, CatchImage, ROI, gauss, throwtempl, templ, catchtempl, gausstempl, result, imagesource, matchresult, croptest, templcheck, sourceedge, templedge; Mat img_display, temprotate, tempscale; Rect box; Point P1(0,0); Point P2(0,0); bool ldown = true; bool lup = false; char* trackbar_label = "Method: \n 0: SQDIFF \n 1: SQDIFF NORMED \n 2: TM CCORR \n 3: TM CCORR NORMED \n 4: TM COEFF \n 5: TM COEFF NORMED"; char* trackbar_type = "Type: \n 0: Binary \n 1: Binary Inverted \n 2: Truncate \n 3: To Zero \n 4: To Zero Inverted"; char* trackbar_value = "Value"; char* trackbar_ksize1 = "ksize 1"; char* trackbar_ksize2 = "ksize 2"; void Threshold( int, void* ); void Gauss(int, void*); void MatchingMethod(int, void*); Mat rotate(Mat src, double angle) { Mat dst; Point2f pt(src.cols/2., src.rows/2.); Mat r = getRotationMatrix2D(pt, angle, 1.0); warpAffine(src, dst, r, Size(src.cols, src.rows)); return dst; } Mat scale(Mat src, double scale) { Mat dst; Point2f pt(src.cols/2., src.rows/2.); Mat r = getRotationMatrix2D(pt, 0, scale); warpAffine(src, dst, r, Size(src.cols, src.rows)); return dst; } int main() { // Load Image image =imread("C:/Users/Asus/Documents/Visual Studio 2012/Projects/ConsoleApplication13/sample/baby01.jpg"); imshow("Real Image",image); // Konversi Image dengan Grayscale cvtColor( image, gray_image, CV_BGR2GRAY ); imshow("Grayscale", gray_image); // Konversi Histogram pada grayscale image dengan Histogram Equalization equalizeHist(gray_image,gray_image); imshow("Histogram Equalization",gray_image); // Mempersiapkan variabel untuk digunakan pada Thresholding ThrowImage = gray_image; // Fungsi Thresholding Threshold(0,0); imagesource = CatchImage; imagesource.copyTo( img_display ); matchresult = image; MatchingMethod( 0, 0 ); if (gender==1) { cout << "Laki-Laki"; } else { cout << "Perempuan"; } cvWaitKey(0); cvDestroyWindow("Real Image"); return 0; } void Threshold( int, void* ) { //Threshold Dari Otsu threshold( ThrowImage, ThrowImage, 50, 255, CV_THRESH_BINARY | CV_THRESH_OTSU ); imshow ("Otsu Threshold", ThrowImage); //Threshold menggunakan Adaptive Threshold dengan weight Mean adaptiveThreshold(ThrowImage, CatchImage,255,ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY,27,-5); imshow ("Adaptive Threshold", CatchImage); } void MatchingMethod( int, void* ) { // Jumlah Template while(i<2) { // Memanggil template sprintf(name,"C:\\sample\\template\\temp%d.jpg",tempread); templ = imread (name,1); tempread++; // Mengubah warna template menjadi grayscale cvtColor( templ, templ, CV_BGR2GRAY ); // Mensegmentasi template dengan otsu threshold threshold( templ, templ, 20, 255, CV_THRESH_BINARY | CV_THRESH_OTSU ); imshow("Otsu", templ); // Mensegmentasi template dengan adaptive thresholding dengan weight mean adaptiveThreshold(templ, throwtempl,255,ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY,27,-5); // Menduplikasi nilai array template kepada variabel temprotate, tempscale temprotate = throwtempl; tempscale = throwtempl; imshow("throwtemplate", throwtempl); // Masuk kedalam rekursif pencocokan ke 1(pencocokan pertama dari ukuran) for (double scaling=0.75; scaling <= 1.25;) { cout << "Scaling = " << scaling << endl; // Metode untuk scaling dari template asli temprotate = scale(tempscale, scaling); // Masuk kedalam rekursif pencocokan ke 2(pencocokan kedua dari derajat) for (degree=0; degree<360;) { cout << "Degree = " << degree << endl; throwtempl = rotate(temprotate, degree); int result_cols = imagesource.cols - throwtempl.cols + 1; int result_rows = imagesource.rows - throwtempl.rows + 1; result.create( result_rows, result_cols, CV_32FC1 ); // Melakukan Matching dan Normalisasi hasil matchTemplate( imagesource, throwtempl, result, CV_TM_SQDIFF_NORMED ); normalize( result, result, 0, 1, NORM_MINMAX, -1, Mat() ); // Menglokalisasikan hasil matching dengan minMaxLoc double minVal; double maxVal; Point minLoc; Point maxLoc; Point matchLoc; minMaxLoc( result, &minVal, &maxVal, &minLoc, &maxLoc, Mat() ); // Untuk CV_TM_SQDIFF, dan CV_TM_SQDIFF_NORMED nilai yang lebih kecil adalah yang paling mirip. // Untuk metode lain, nilai lebih tinggi berarti lebih baik if( match_method == CV_TM_SQDIFF || match_method == CV_TM_SQDIFF_NORMED ) { matchLoc = minLoc; } else { matchLoc = maxLoc; } // Mengekstrasi area yang dianggap paling mirip dengan template oleh metode template matching Rect ROI(matchLoc.x, matchLoc.y , throwtempl.cols, throwtempl.rows); Mat ROIPIC = imagesource(ROI); imshow("ROIPIC", ROIPIC); // Menghitung jumlah pixel ROIPIC dan Template int WhiteA = countNonZero(ROIPIC); int WhiteB = countNonZero(throwtempl); // parameter tanda int mark = 0; int valuea, valueb; // Jika Jumlah pixel ROIPIC lebih besar daripada template maka diberi tanda if (WhiteA > WhiteB) { mark=1; } // Pengecekan nilai pixel berdasarkan baris for(int countx = 0; countx < ROIPIC.rows; countx++) { // Pengecekan niali pixel berdasarkan kolom for(int county = 0; county < ROIPIC.cols; county++) { // Memasukan nilai Pixel dari ROIPIC dan Template pada variabel valuea dan valueb valuea = ((int)ROIPIC.at(countx,county)); valueb = ((int)throwtempl.at(countx,county)); if (mark=1) { // Jika jumlah pixel putih pada ROIPIC lebih besar daripada Template maka // perhitungan perbedaan berdasarkan ROIPIC, maka jumlah pixel berbeda akan bertambah if (valueb > 0 && valuea == 0 ) { JumlahPixelBeda=JumlahPixelBeda+1; } } else { // Jika jumlah pixel putih pada template lebih besar daripada ROIPIC maka // perhitungan perbedaan berdasarkan template, maka jumlah pixel berbeda akan bertambah if (valuea > 0 && valueb ==0) { JumlahPixelBeda=JumlahPixelBeda+1; } } // Jika pixel di titik tertentu pada template adalah putih dan demikian pula dengan // pixel di titik yang sama pada ROIPIC, maka Jumlah pixel sama akan bertambah if (valueb > 0 && valuea > 0) { JumlahPixelSama=JumlahPixelSama+1; } } } // Total dari pixel yang dibandingkan TotalPixel = JumlahPixelBeda + JumlahPixelSama; // Persentase tingkat kemiripan persentase = (JumlahPixelSama/TotalPixel)*100; // Laporan hasil perbandingan cout << "Jumlah Pixel Berbeda = " << JumlahPixelBeda << endl<< "Jumlah Pixel Sama = "<< JumlahPixelSama << endl << "Total Pixel = " << TotalPixel << endl<< "Persentase = "<< persentase << endl; // Derajat ditambahkan sebesar 15 derajat degree = degree +15; // Jika tingkat kemiripan lebih dari 75% if (persentase > 75) { // Nilai persentase disimpan pada variabel temporer persentemp = persentase; // Jika nilai persentase yang baru lebih besar dari nilai persentase sebelumnya if (persenhigh < persentemp) { // persentase yang lama sama dengan persentase yang baru persenhigh = persentemp; // Titik lokasi disimpan dalam variabel temporer MatchLocTemp = matchLoc; MatchLocTemp.x = matchLoc.x; MatchLocTemp.y = matchLoc.y; throwtempX = throwtempl.cols; throwtempY = throwtempl.rows; } // Reset seluruh nilai pengecekan variabel result_cols=0; result_rows=0; minVal=0; maxVal=0; valuea=0; valueb=0; TotalPixel=0; JumlahPixelBeda=0; JumlahPixelSama=0; persentase=0; matchLoc.x = 0; throwtempl.cols = 0; matchLoc.y = 0; throwtempl.rows = 0; Point minLoc=0; Point maxLoc=0; Point matchLoc=0; mark =0; // Jenis kelamin terdeteksi sebagai laki-laki gender=1; // Jika Persentase diatas 82% if (persentase > 82) { // Scaling dihentikan untuk template tersebut scaling = 1.6; } break; } else { // Reset seluruh nilai pengecekan variabel result_cols=0; result_rows=0; minVal=0; maxVal=0; valuea=0; valueb=0; TotalPixel=0; JumlahPixelBeda=0; JumlahPixelSama=0; persentase=0; matchLoc.x = 0; throwtempl.cols = 0; matchLoc.y = 0; throwtempl.rows = 0; Point minLoc=0; Point maxLoc=0; mark =0; Point matchLoc=0; } } // reset nilai derajat, dan menaikan scale sebesar 0.025 degree = 0; scaling=scaling+0.025; } i++; } // Menggambarkan kotak disekitar titik yang dianggap sebagai lokasi dari kelamin janin rectangle( img_display, MatchLocTemp, Point( MatchLocTemp.x + throwtempX , MatchLocTemp.y + throwtempY ), Scalar (100, 155, 25), 2, 8, 0 ); rectangle( matchresult, MatchLocTemp, Point( MatchLocTemp.x + throwtempX , MatchLocTemp.y + throwtempY ), Scalar (100, 155, 25), 2, 8, 0 ); rectangle( result, MatchLocTemp, Point( MatchLocTemp.x + throwtempX , MatchLocTemp.y + throwtempY ), Scalar (100, 155, 25), 2, 8, 0 ); imshow( "TemplateMatchResult", img_display ); imshow( "Match Result", matchresult); imshow( "Result window", result ); i=100; return; } thanks !

Viewing all articles
Browse latest Browse all 41027