Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
39
Task/Hough-transform/SequenceL/hough-transform-2.sequencel
Normal file
39
Task/Hough-transform/SequenceL/hough-transform-2.sequencel
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "SL_Generated.h"
|
||||
#include "CImg.h"
|
||||
|
||||
using namespace cimg_library;
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
string fileName = "Pentagon.bmp";
|
||||
if(argc > 1) fileName = argv[1];
|
||||
int thetaAxisSize = 640; if(argc > 2) thetaAxisSize = atoi(argv[2]);
|
||||
int rAxisSize = 480; if(argc > 3) rAxisSize = atoi(argv[3]);
|
||||
int minContrast = 64; if(argc > 4) minContrast = atoi(argv[4]);
|
||||
int threads = 0; if(argc > 5) threads = atoi(argv[5]);
|
||||
char titleBuffer[200];
|
||||
SLTimer t;
|
||||
|
||||
CImg<int> image(fileName.c_str());
|
||||
int imageDimensions[] = {image.height(), image.width(), 0};
|
||||
Sequence<Sequence<int> > imageSeq((void*) image.data(), imageDimensions);
|
||||
Sequence< Sequence<int> > result;
|
||||
|
||||
sl_init(threads);
|
||||
|
||||
t.start();
|
||||
sl_hough(imageSeq, thetaAxisSize, rAxisSize, minContrast, threads, result);
|
||||
t.stop();
|
||||
|
||||
CImg<int> resultImage(result[1].size(), result.size());
|
||||
for(int y = 0; y < result.size(); y++)
|
||||
for(int x = 0; x < result[y+1].size(); x++)
|
||||
resultImage(x,result.size() - 1 - y) = result[y+1][x+1];
|
||||
|
||||
sprintf(titleBuffer, "SequenceL Hough Transformation: %d X %d Image to %d X %d Result | %d Cores | Processed in %f sec\0",
|
||||
image.width(), image.height(), resultImage.width(), resultImage.height(), threads, t.getTime());
|
||||
resultImage.display(titleBuffer);
|
||||
|
||||
sl_done();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue