fork download
  1. testWidget::testWidget(QWidget *parent):QWidget(parent)
  2. {
  3. setFixedSize(600, 400);
  4.  
  5. QPushButton *btnCreateFlist = new QPushButton(tr("createFlist"),this);
  6. btnCreateFlist->setGeometry(100, 100, 200, 150);
  7. btnCreateFlist->setFont(QFont("Times", 18, QFont::Bold));
  8.  
  9. showString = new QLabel;
  10. showString->setText(tr("Hello QT!"));
  11. showString->setGeometry(200,100,100,20);
  12. showString->setFont(QFont("Times", 12, QFont::Bold));
  13.  
  14. rCaliImgLOG = new QLabel;
  15. rCaliImgLOG->setText(tr("CaliBration Image Read"));
  16. rCaliImgLOG->setGeometry(200,160,100,60);
  17. rCaliImgLOG->setFont(QFont("Times",12,QFont::Thin));
  18.  
  19.  
  20. QSlider *slider = new QSlider(Qt::Horizontal);
  21. slider->setRange(0, 99);
  22. slider->setValue(0);
  23.  
  24.  
  25. QVBoxLayout *layout = new QVBoxLayout;
  26. layout->addWidget(showString);
  27. layout->addWidget(rCaliImgLOG);
  28. layout->addWidget(slider);
  29. layout->addWidget(btnCreateFlist);
  30.  
  31. setLayout(layout);
  32.  
  33. QObject::connect(btnCreateFlist, SIGNAL(clicked()) , this, SLOT(createFilst()));
  34.  
  35.  
  36. }
  37.  
  38. void testWidget:: createFilst()
  39. {
  40. FILE *img_txt;
  41. FILE *rFolderList, *rFileList, *rImg, *wImg;
  42. char sys_cmd[200], folderName[200], fileName[200], fileAddr[500];
  43. char new_fileAddr[200];
  44. unsigned char header[1078]={0}, times=0;//, img_ori2[RES_1016_IMAGE_SIZE]={0}
  45. unsigned long width, height;
  46.  
  47. //read Calibration Image
  48.  
  49. testWidget::readCaliImg("Calibration.y");
  50.  
  51. cout<<testWidget::caliImgName<<endl;
  52.  
  53. sprintf(sys_cmd,"dir /A:D /b t* > folder_list.txt");
  54. system(sys_cmd);
  55.  
  56. sprintf(sys_cmd,"md newProc");
  57. system(sys_cmd);
  58.  
  59. rFolderList = fopen("folder_list.txt", "rt");
  60.  
  61. while(EOF!=fscanf(rFolderList,"%s",folderName))
  62. {
  63. sprintf(sys_cmd,"md newProc\\%s",folderName);
  64. system(sys_cmd);
  65.  
  66. sprintf(sys_cmd,"dir /b %s\\*.bmp > file_list.txt", folderName);
  67. system(sys_cmd);
  68.  
  69. rFileList = fopen("file_list.txt","rt");
  70.  
  71. while(EOF!=fscanf(rFileList,"%s",fileName))
  72. {
  73. // for(int i=0; i<RES_1016_IMAGE_SIZE; i++)
  74. // {
  75. // img_ori[i] = 0;
  76. // img_dst[i] = 0;
  77. // }
  78. img_txt=fopen("img.txt","wt");
  79.  
  80. sprintf(fileAddr,"%s\\%s",folderName,fileName);
  81. sprintf(new_fileAddr,"newProc\\%s\\%s",folderName,fileName);
  82. rImg = fopen(fileAddr,"rb");
  83.  
  84. if(rImg == NULL)
  85. {
  86. // showString->setText(tr("Read File ERROR!!!"));
  87. showString->setText(tr(fileAddr));
  88. }
  89. showString->setText(tr(fileAddr));
  90. wImg = fopen(new_fileAddr,"wb");
  91.  
  92. fread(header,sizeof(unsigned char),1078,rImg);
  93. fwrite(header,sizeof(unsigned char),1078,wImg);
  94.  
  95. fseek(rImg,18,SEEK_SET);
  96. fread(&width,sizeof(unsigned long),1,rImg);
  97. fread(&height,sizeof(unsigned long),1,rImg);
  98. fseek(rImg,1078,SEEK_SET);
  99.  
  100. // if(times==0)
  101. // {
  102. // img_ori=(unsigned char*)malloc(width*height*sizeof(unsigned char));
  103. // img_dst=(unsigned char*)malloc(width*height*sizeof(unsigned char));
  104. // times++;
  105. // }
  106.  
  107.  
  108.  
  109. fread(img_ori,sizeof(unsigned char),width*height, rImg);
  110.  
  111. testWidget::imgProc();
  112. // inverseImage((int)width, (int)height, img_ori, img_dst);
  113. // applyISP((int)width, (int)height, img_ori, img_dst, caliImg);//
  114. for(int i=0; i<(int)(width*height); i++)
  115. {
  116. // img_dst[i]=img_ori[i];
  117. fprintf(img_txt, "%03d\t", img_dst[i]);
  118. }
  119.  
  120. fwrite(img_dst,sizeof(unsigned char),width*height, wImg);
  121.  
  122. fclose(rImg);
  123. fclose(wImg);
  124. fclose(img_txt);
  125. }
  126. // showString->setText(tr(fileName));
  127. }
  128.  
  129. fclose(rFolderList);
  130. fclose(rFileList);
  131.  
  132.  
  133. // free(img_ori);
  134. // free(img_dst);
  135.  
  136. }
  137.  
  138. void testWidget::readCaliImg(string caliImgName)//char *caliImgName
  139. {
  140. FILE *rCaliImg;
  141.  
  142. rCaliImg=fopen(caliImgName.c_str(),"rb"); //string to char[] -> caliImgName.c_str()
  143. // rCaliImg=fopen(caliImgName,"rb");
  144.  
  145. if(rCaliImg == NULL)
  146. rCaliImgLOG->setText(rCaliImgLOG->text() + " Error!");
  147. else
  148. rCaliImgLOG->setText(rCaliImgLOG->text() + " Success!");
  149.  
  150. fread(caliImg,sizeof(unsigned char),RES_1016_IMAGE_SIZE,rCaliImg);
  151.  
  152. fclose(rCaliImg);
  153. }
  154.  
  155.  
  156. void testWidget::imgProc()//
  157. {
  158.  
  159. showString->setText(tr("Doing imgProc!!!!!!!!!!!!!!!!"));
  160.  
  161. for(int i=0; i<(int)(width*height); i++)
  162. {
  163. img_dst[i]=(unsigned char)255;
  164.  
  165. }
  166.  
  167. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: ‘testWidget’ does not name a type
 testWidget::testWidget(QWidget *parent):QWidget(parent)
 ^~~~~~~~~~
prog.cpp:38:6: error: ‘testWidget’ has not been declared
 void testWidget:: createFilst()
      ^~~~~~~~~~
prog.cpp: In function ‘void createFilst()’:
prog.cpp:40:1: error: ‘FILE’ was not declared in this scope
 FILE *img_txt;
 ^~~~
prog.cpp:40:7: error: ‘img_txt’ was not declared in this scope
 FILE *img_txt;
       ^~~~~~~
prog.cpp:41:7: error: ‘rFolderList’ was not declared in this scope
 FILE *rFolderList, *rFileList, *rImg, *wImg;
       ^~~~~~~~~~~
prog.cpp:41:21: error: ‘rFileList’ was not declared in this scope
 FILE *rFolderList, *rFileList, *rImg, *wImg;
                     ^~~~~~~~~
prog.cpp:41:33: error: ‘rImg’ was not declared in this scope
 FILE *rFolderList, *rFileList, *rImg, *wImg;
                                 ^~~~
prog.cpp:41:40: error: ‘wImg’ was not declared in this scope
 FILE *rFolderList, *rFileList, *rImg, *wImg;
                                        ^~~~
prog.cpp:49:5: error: ‘testWidget’ has not been declared
     testWidget::readCaliImg("Calibration.y");
     ^~~~~~~~~~
prog.cpp:51:5: error: ‘cout’ was not declared in this scope
     cout<<testWidget::caliImgName<<endl;
     ^~~~
prog.cpp:51:11: error: ‘testWidget’ has not been declared
     cout<<testWidget::caliImgName<<endl;
           ^~~~~~~~~~
prog.cpp:51:36: error: ‘endl’ was not declared in this scope
     cout<<testWidget::caliImgName<<endl;
                                    ^~~~
prog.cpp:53:56: error: ‘sprintf’ was not declared in this scope
     sprintf(sys_cmd,"dir /A:D /b t* >  folder_list.txt");
                                                        ^
prog.cpp:54:19: error: ‘system’ was not declared in this scope
     system(sys_cmd);
                   ^
prog.cpp:59:48: error: ‘fopen’ was not declared in this scope
     rFolderList = fopen("folder_list.txt", "rt");
                                                ^
prog.cpp:61:11: error: ‘EOF’ was not declared in this scope
     while(EOF!=fscanf(rFolderList,"%s",folderName))
           ^~~
prog.cpp:61:50: error: ‘fscanf’ was not declared in this scope
     while(EOF!=fscanf(rFolderList,"%s",folderName))
                                                  ^
prog.cpp:84:24: error: ‘NULL’ was not declared in this scope
             if(rImg == NULL)
                        ^~~~
prog.cpp:87:17: error: ‘showString’ was not declared in this scope
                 showString->setText(tr(fileAddr));
                 ^~~~~~~~~~
prog.cpp:87:48: error: ‘tr’ was not declared in this scope
                 showString->setText(tr(fileAddr));
                                                ^
prog.cpp:89:13: error: ‘showString’ was not declared in this scope
             showString->setText(tr(fileAddr));
             ^~~~~~~~~~
prog.cpp:89:44: error: ‘tr’ was not declared in this scope
             showString->setText(tr(fileAddr));
                                            ^
prog.cpp:92:57: error: ‘fread’ was not declared in this scope
             fread(header,sizeof(unsigned char),1078,rImg);
                                                         ^
prog.cpp:93:58: error: ‘fwrite’ was not declared in this scope
             fwrite(header,sizeof(unsigned char),1078,wImg);
                                                          ^
prog.cpp:95:27: error: ‘SEEK_SET’ was not declared in this scope
             fseek(rImg,18,SEEK_SET);
                           ^~~~~~~~
prog.cpp:95:35: error: ‘fseek’ was not declared in this scope
             fseek(rImg,18,SEEK_SET);
                                   ^
prog.cpp:109:19: error: ‘img_ori’ was not declared in this scope
             fread(img_ori,sizeof(unsigned char),width*height, rImg);
                   ^~~~~~~
prog.cpp:111:13: error: ‘testWidget’ has not been declared
             testWidget::imgProc();
             ^~~~~~~~~~
prog.cpp:117:44: error: ‘img_dst’ was not declared in this scope
                 fprintf(img_txt, "%03d\t", img_dst[i]);
                                            ^~~~~~~
prog.cpp:117:54: error: ‘fprintf’ was not declared in this scope
                 fprintf(img_txt, "%03d\t", img_dst[i]);
                                                      ^
prog.cpp:120:20: error: ‘img_dst’ was not declared in this scope
             fwrite(img_dst,sizeof(unsigned char),width*height, wImg);
                    ^~~~~~~
prog.cpp:122:24: error: ‘fclose’ was not declared in this scope
             fclose(rImg);
                        ^
prog.cpp:129:23: error: ‘fclose’ was not declared in this scope
     fclose(rFolderList);
                       ^
prog.cpp: At global scope:
prog.cpp:138:6: error: ‘testWidget’ has not been declared
 void testWidget::readCaliImg(string caliImgName)//char *caliImgName
      ^~~~~~~~~~
prog.cpp:138:30: error: variable or field ‘readCaliImg’ declared void
 void testWidget::readCaliImg(string caliImgName)//char *caliImgName
                              ^~~~~~
prog.cpp:138:30: error: ‘string’ was not declared in this scope
prog.cpp:156:6: error: ‘testWidget’ has not been declared
 void testWidget::imgProc()//
      ^~~~~~~~~~
prog.cpp: In function ‘void imgProc()’:
prog.cpp:159:5: error: ‘showString’ was not declared in this scope
     showString->setText(tr("Doing imgProc!!!!!!!!!!!!!!!!"));
     ^~~~~~~~~~
prog.cpp:159:59: error: ‘tr’ was not declared in this scope
     showString->setText(tr("Doing imgProc!!!!!!!!!!!!!!!!"));
                                                           ^
prog.cpp:161:23: error: ‘width’ was not declared in this scope
  for(int i=0; i<(int)(width*height); i++)
                       ^~~~~
prog.cpp:161:29: error: ‘height’ was not declared in this scope
  for(int i=0; i<(int)(width*height); i++)
                             ^~~~~~
prog.cpp:163:9: error: ‘img_dst’ was not declared in this scope
         img_dst[i]=(unsigned char)255;
         ^~~~~~~
stdout
Standard output is empty