int main(int argc, char *argv[]) { // Read command line files // Init cuda CUcontext cuContext; initCuda(cuContext); // Image buffer allocation unsigned int depth =4; unsigned int width=960; unsigned int height=1080; size_t bufferSize = sizeof(unsigned char)*width*height*depth; unsigned char *imgRight = (unsigned char*)malloc(bufferSize); unsigned char *imgLeft= (unsigned char*)malloc(bufferSize); // Read the list of test files std::vector<std::string> testsFiles; readTestsFiles(testsFiles, "./tests.txt"); // Launch tests for(int i=0; i<testsFiles.size(); i++) { std::stringstream testImage1; testImage1 << "./" << testsFiles[i] << "_1.dat"; std::stringstream testImage2; testImage2 << "./" << testsFiles[i] << "_2.dat"; readTestImage( testImage1.str(), imgRight, bufferSize); readTestImage( testImage2.str(), imgLeft, bufferSize); VertexBufferObject rightPoints; VertexBufferObject leftPoints; DescriptorData rightDescriptors; DescriptorData leftDescriptors; computeDescriptorsLane(imgRight, depth, width, height, rightPoints, rightDescriptors); computeDescriptorsLane(imgLeft, depth, width, height, leftPoints, leftDescriptors); UInt2 imgSize(1920,1080); vector<CvPoint2D32f> leftMatchedPts; vector<CvPoint2D32f> rightMatchedPts; leftMatchedPts.reserve(10000); rightMatchedPts.reserve(10000); computeMatching( leftDescriptors, rightDescriptors, leftMatchedPts, rightMatchedPts, imgSize); } // finalize cuda CUresult cerr = cuCtxDestroy(cuContext); checkError(cerr); return 0; }
bool MNISTReader::readMNISTImages(QString trainingFile, QString testFile) { bool success = readTrainingImage(trainingFile); if(!success) { qDebug() << "Can't read MNIST training images"; return false; } success = readTestImage(testFile); if(!success) { qDebug() << "Cant' open MNIST test file"; return false; } qDebug() << "Success Readin" << endl; return true; }
QString uid = "testImage"; QString filename = cx::DataLocations::getTestDataPath()+"/Phantoms/BoatPhantom/MetaImage/baatFantom.mhd"; //Copied from loadImageFromFile() in cxtestDicomConverter.cpp cx::ImagePtr image = cx::Image::create(uid,uid); cx::MetaImageReader().readInto(image, filename); return image; } } //namespace namespace cxtest { TEST_CASE("Image copy: id copied", "[unit][resource][core]") { cx::ImagePtr image = readTestImage(); cx::ImagePtr imageCopy = image->copy(); REQUIRE(image->getUid() == imageCopy->getUid()); } TEST_CASE("Image copy: vtkImage copied", "[unit][resource][core]") { cx::ImagePtr image = readTestImage(); cx::ImagePtr imageCopy = image->copy(); vtkImageDataPtr vtkImage = image->getBaseVtkImageData(); vtkImageDataPtr vtkImageCopy = imageCopy->getBaseVtkImageData(); REQUIRE(vtkImageCopy); REQUIRE(vtkImage != vtkImageCopy); int* dimsCopy = vtkImageCopy->GetDimensions(); int* dims = vtkImage->GetDimensions();