Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added experiment/simulation/build/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added experiment/simulation/build/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions experiment/simulation/build/allexec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export OPENCV_INC=/usr/include/opencv
export OPENCV_LIB=/usr/lib/
export OPENCV_LIB_OPTS="-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann"

sudo apt-get update
sudo apt-get install -y gcc
sudo apt-get update
gcc -I$OPENCV_INC codes/latest_affine.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/affine.out
gcc -I$OPENCV_INC codes/im_arith.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/arith.out
gcc -I$OPENCV_INC codes/im_dist.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/dist.out
gcc -I$OPENCV_INC codes/im_fourier.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/fourier.out
gcc -I$OPENCV_INC codes/im_hist.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/hist.out
gcc -I$OPENCV_INC codes/im_morphology.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/morpho.out
gcc -I$OPENCV_INC codes/im_nbrhood.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/neigh.out
gcc -I$OPENCV_INC codes/im_path.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/path.out
gcc -I$OPENCV_INC codes/im_point.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/point.out
gcc -I$OPENCV_INC codes/im_segment.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/segment.out
gcc -I$OPENCV_INC codes/im_colour.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/colour.out
gcc -I$OPENCV_INC codes/im_colourLin.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/colour2.out
gcc -I$OPENCV_INC codes/im_colhist.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/colour3.out
gcc -I$OPENCV_INC codes/im_colhist.cpp -L$OPENCV_LIB $OPENCV_LIB_OPTS -o execs/colhist.out
12 changes: 12 additions & 0 deletions experiment/simulation/build/analyticstracking.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Google Analytics Code starts here -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-42255654-1', 'virtual-labs.ac.in');
ga('send', 'pageview');

</script>
<!-- Google Analytics Code ends here -->
87 changes: 87 additions & 0 deletions experiment/simulation/build/assign.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
session_start();
$exp=$_GET["exp"];
?>

<head>
<script class='gtm'>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-W59SWTR');</script>

<title> Assignment - Virtual Lab in Image Processing</title>
<!-- The Primary External CSS style sheet. -->
<link rel="stylesheet" type="text/css" href="css/psd2css.css" media="screen" />

<!-- We use the jquery javascript library for DOM manipulation and
some javascript tricks. We serve the script from Google because it's
faster than most ISPs. Get more information and documentation
at http://jquery.com
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> -->
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>

<!-- All the javascript generated for your design is in this file -->
<script type="text/javascript" src="js/psd2css.js"></script>

<!--http://www.cssmenumaker.com/builder/menu_info.php?menu=057-->
<link type="text/css" rel="StyleSheet" href="menu/menu_style.css" />


</head>


<body>

<!-- This is 'Backgound_bkgnd_center_jpg' -->
<div id="Layer-1" class="Backgound_bkgnd_center_jpg" >


<!-- This is 'TopBar_jpg' -->
<div id="Layer-3" class="TopBar_jpg" >
<!-- <img src="images/Layer-3.jpg" width="894" height="96" alt="TopBar" /> -->
<!-- This is 'IIIT' -->
<!-- <div id="Layer-6" class="IIIT" >
<img src="images/iiit.png" width="100" height="70" alt="IIIT" class="pngimg" />
</div>

<div id="topMenu">
<h1>VIRTUAL LAB in IMAGE PROCESSING</h1>
<div class="home">
<a href="index.html">home</a>
</div>

<div class="menu">
<ul>
<li><a href="objective.php?exp=<?php echo $exp; ?>" target="_self" >Objective</a>
</li>
<li><a href="intro.php?exp=<?php echo $exp; ?>" target="_self" >Introduction</a>
</li>
<li><a href="theory.php?exp=<?php echo $exp; ?>" target="_self" >Theory</a>
</li>
<li><a href="procedure.php?exp=<?php echo $exp; ?>" target="_self" >Procedure</a>
</li>
<li><a href="<?php echo $exp; ?>.php" target="_self" >Experiment</a>
</li> -->
<!-- <li><sel><a href="#" target="_self" >Assessment</a>
</sel>
--> <!-- <ul>
<li><a href="quiz.php?exp=<?php echo $exp; ?>">Quiz</a></li> -->
<li><a href="assign.php?exp=<?php echo $exp; ?>">Assignment</a></li>
<!-- </ul>

</li> -->
<!-- <li><a href="references.php?exp=<?php echo $exp; ?>" target="_self" >References</a>
</li> -->
</ul>
</div>
</div>
<div class="experiment front" style="text-indent: 20px; background-color: #DDDDDD;" >

<b>Obtain the figure of the right from the figure on the left.</b>
<br/><br/>
<img src="images/temp/<?php echo $exp; ?>1_1.<?php if($exp=="colour") { echo 'jpg'; } else { echo 'png';} ?>"/>&nbsp;&nbsp; <img src="images/temp/<?php echo $exp; ?>1_1_result.<?php if($exp=="colour") { echo 'jpg'; } else { echo 'png';} ?>"/>
<br/>

Click <a href="<?php echo $exp; ?>.php?assess=<?php echo $exp; ?>1" target="_blank">here</a> to try it out.
</div>
</div>
</body>


194 changes: 194 additions & 0 deletions experiment/simulation/build/codes/HIST_backup.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <stdio.h>
#include<iostream>
using namespace std;

void create_histogram_image(IplImage* bin_img, IplImage* hist_img,int bins) {
CvHistogram *hist;

int fc = 256/bins;
int hist_size = 256/fc;
float range[]={0,256/fc};
float* ranges[] = { range };
float max_value = 0.0;
float w_scale = 0.0;

// create array to hold histogram values
hist = cvCreateHist(1, &hist_size, CV_HIST_ARRAY, ranges, 1);

// calculate histogram values
cvCalcHist( &bin_img, hist, 0, NULL );

// Get the minimum and maximum values of the histogram
cvGetMinMaxHistValue( hist, 0, &max_value, 0, 0 );

// set height by using maximim value
cvScale( hist->bins, hist->bins, ((float)hist_img->height)/max_value, 0 );

// calculate width
w_scale = ((float)hist_img->width)/hist_size;

// plot the histogram
for( int i = 0; i < hist_size; i++ ) {

cvRectangle( hist_img, cvPoint((int)i*w_scale , hist_img->height),
cvPoint((int)(i+1)*w_scale, hist_img->height - cvRound(cvGetReal1D(hist->bins,i))),
cvScalar(0), -1, 8, 0 );

}
}
IplImage* Pre_Process(IplImage* src,int bins)
{
int c = cvGetSize(src).width;
int r = cvGetSize(src).height;

IplImage* final_img=cvCreateImage(cvSize(src->width,src->height),src->depth,src->nChannels);
cvZero(final_img);
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
CvScalar s1,s;
s1 = cvGet2D(src,i,j);
int grval = s1.val[0];
if(bins==32)
grval = grval/8;
if(bins==64)
grval = grval/4;
if(bins==128)
grval = grval/2;
// cout<<grval<<" ";
s.val[0]=grval;
cvSet2D(final_img,i,j,s);
}
}
return final_img;
}

int main( int argc, char** argv )

{
IplImage *source = cvLoadImage(argv[1],0);
char *img_nm,*img_typ;
img_nm = strtok (argv[2],".");
img_typ = strtok (NULL, ".");
int nbins = atoi(argv[3]);
IplImage *bin_img = cvCreateImage(cvSize( source->width, source->height ), IPL_DEPTH_8U, 1 );
if(nbins!=256)
bin_img = Pre_Process(source,nbins);
else
bin_img = cvCloneImage(source);

int c = cvGetSize(bin_img).width;
int r = cvGetSize(bin_img).height;

IplImage *bin_img1 = cvCreateImage(cvSize( source->width/2, source->height/2 ), IPL_DEPTH_8U, 1 );
int mn4=300,mx4=-1,avg4=0;
for(int i=0;i<r/2;i++)
{
for(int j=0;j<c/2;j++)
{
CvScalar s;
s = cvGet2D(bin_img,i,j);
if(s.val[0] < mn4)
mn4 = s.val[0];
if(s.val[0] > mx4)
mx4 = s.val[0];
avg4+=s.val[0];
cvSet2D(bin_img1,i,j,s);
}
}
avg4 = 4*avg4/(r*c);

IplImage *hist_img = cvCreateImage(cvSize(300,300), 8, 1);
cvSet( hist_img, cvScalarAll(255), 0 );
create_histogram_image(bin_img1, hist_img,nbins);
char nam[30];
int n = sprintf(nam,"%s_1.%s",img_nm,img_typ);
cvSaveImage(nam,hist_img);

IplImage *bin_img2 = cvCreateImage(cvSize( source->width/2, source->height/2 ), IPL_DEPTH_8U, 1 );
int mn1=300,mx1=-1,avg1=0;
for(int i=0;i<r/2;i++)
{
for(int j=c/2;j<c;j++)
{
CvScalar s;
s = cvGet2D(bin_img,i,j);
if(s.val[0] < mn1)
mn1 = s.val[0];
if(s.val[0] > mx1)
mx1 = s.val[0];
avg1+=s.val[0];
cvSet2D(bin_img2,i,j-c/2,s);
}
}
avg1 = 4*avg1/(r*c);

hist_img = cvCreateImage(cvSize(300,300), 8, 1);
cvSet( hist_img, cvScalarAll(255), 0 );
create_histogram_image(bin_img2, hist_img,nbins);
n = sprintf(nam,"%s_2.%s",img_nm,img_typ);
cvSaveImage(nam,hist_img);

IplImage *bin_img3 = cvCreateImage(cvSize( source->width/2, source->height/2 ), IPL_DEPTH_8U, 1 );
int mn2=300,mx2=-1,avg2=0;
for(int i=r/2;i<r;i++)
{
for(int j=0;j<c/2;j++)
{
CvScalar s;
s = cvGet2D(bin_img,i,j);
if(s.val[0] < mn2)
mn2 = s.val[0];
if(s.val[0] > mx2)
mx2 = s.val[0];
avg2+=s.val[0];
cvSet2D(bin_img3,i-r/2,j,s);
}
}
avg2 = 4*avg2/(r*c);

hist_img = cvCreateImage(cvSize(300,300), 8, 1);
cvSet( hist_img, cvScalarAll(255), 0 );
create_histogram_image(bin_img3, hist_img,nbins);
n = sprintf(nam,"%s_3.%s",img_nm,img_typ);
cvSaveImage(nam,hist_img);


IplImage *bin_img4 = cvCreateImage(cvSize( source->width/2, source->height/2 ), IPL_DEPTH_8U, 1 );
int mn3=300,mx3=-1,avg3=0;
for(int i=r/2;i<r;i++)
{
for(int j=c/2;j<c;j++)
{
CvScalar s;
s = cvGet2D(bin_img,i,j);
if(s.val[0] < mn3)
mn3 = s.val[0];
if(s.val[0] > mx3)
mx3 = s.val[0];
avg3+=s.val[0];
cvSet2D(bin_img4,i-r/2,j-c/2,s);
}
}
avg3 = 4*avg3/(r*c);

hist_img = cvCreateImage(cvSize(300,300), 8, 1);
cvSet( hist_img, cvScalarAll(255), 0 );
create_histogram_image(bin_img4, hist_img,nbins);
n = sprintf(nam,"%s_4.%s",img_nm,img_typ);
cvSaveImage(nam,hist_img);

cvReleaseImage( &source );
cvReleaseImage( &hist_img );
cvReleaseImage( &bin_img );
cvReleaseImage( &bin_img1 );
cvReleaseImage( &bin_img2 );
cvReleaseImage( &bin_img3 );
cvReleaseImage( &bin_img4 );

cout<<mn1<<" "<<mx1<<" "<<avg1<<" "<<mn2<<" "<<mx2<<" "<<avg2<<" "<<mn3<<" "<<mx3<<" "<<avg3<<" "<<mn4<<" "<<mx4<<" "<<avg4<<endl;
return 0;
}
4 changes: 4 additions & 0 deletions experiment/simulation/build/codes/affine.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gcc -I/home/intel/opencv/include/opencv -L/home/intel/opencv/lib -lcv -lhighgui -lstdc++ -o affine.out latest_affine.cpp
./affine.out stock1.jpg dst.jpg 1 0 1 186 88 64 3 2 1
# display stock1.jpg
# display dst.jpg
6 changes: 6 additions & 0 deletions experiment/simulation/build/codes/arith.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gcc -I/home/intel/opencv/include/opencv -L/home/intel/opencv/lib -lcv -lhighgui -lstdc++ -o arith.out im_arith.cpp
./arith.out dst_1.jpg dst_2.jpg dst.jpg 3 2
display dst_1.jpg
display dst_2.jpg
display dst.jpg

Loading