diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml
new file mode 100644
index 0000000..2fc4e5a
--- /dev/null
+++ b/.github/workflows/ccpp.yml
@@ -0,0 +1,18 @@
+name: C/C++ CI
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: make distcheck
+ run: make distcheck
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 0000000..aa91291
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,19 @@
+# Starter pipeline
+# Start with a minimal pipeline that you can customize to build and deploy your code.
+# Add steps that build, run tests, deploy, and more:
+# https://aka.ms/yaml
+
+trigger:
+- master
+
+pool:
+ vmImage: 'ubuntu-latest'
+
+steps:
+- script: echo Hello, world!
+ displayName: 'Run a one-line script'
+
+- script: |
+ echo Add other tasks to build, test, and deploy your project.
+ echo See https://aka.ms/yaml
+ displayName: 'Run a multi-line script'
diff --git a/help/en_US/adaptHistEq.xml b/help/en_US/adaptHistEq.xml
new file mode 100644
index 0000000..1b87fbf
--- /dev/null
+++ b/help/en_US/adaptHistEq.xml
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+ adaptHistEq
+ Performs Contrast Limited Adaptive Histogram Equalisation
+
+
+
+
+ Calling Sequence
+
+ outputImage = adaptHistEq(inputImage)
+ outputImage = adaptHistEq(inputImage, clip_limit)
+
+
+
+
+
+ Parameters
+
+ inputImage :
+ The input image on which histogram equalisation is to be implemented
+ clip_limit :
+ The target hgram bins.
+
+
+
+
+ Description
+
+As an alternative to using histeq, you can perform contrast-limited adaptive histogram equalization (CLAHE) using the adapthisteq function. While histeq works on the entire image, adapthisteq operates on small regions in the image, called tiles. Each tile's contrast is enhanced, so that the histogram of the output region approximately matches a specified histogram. After performing the equalization, adapthisteq combines neighboring tiles using bilinear interpolation to eliminate artificially induced boundaries.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Yash Balghat
+
+
+
diff --git a/help/en_US/boxfilter.xml b/help/en_US/boxfilter.xml
new file mode 100644
index 0000000..535b505
--- /dev/null
+++ b/help/en_US/boxfilter.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ boxfilter
+ Blurs an image using the box filter.
+
+
+
+
+ Calling Sequence
+
+ outputImage = boxfilter(InputArraysrc, intddepth,size1x,size1y,pointx,pointy, bool_normalize)
+
+
+
+
+
+ Parameters
+
+ InputArraysrc :
+ Input image to be blurred
+ intddepth :
+ The output image depth (-1 to use src.depth())
+ size1x :
+ Width for the blurring kernel size
+ size1y :
+ Height for the blurring kernel size
+ pointx :
+ x-coordinate for anchor point (Default value -1)
+ pointy :
+ y-coordinate for anchor point (Default value -1)
+ bool_normalize :
+ flag, specifying whether the kernel is normalized by its area or not
+
+
+
+
+ Description
+
+Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on).
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Priyanka Hiranandani, NIT Surat
+
+
+
diff --git a/help/en_US/denoiseColor.xml b/help/en_US/denoiseColor.xml
new file mode 100644
index 0000000..d58f39e
--- /dev/null
+++ b/help/en_US/denoiseColor.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+ denoiseColor
+ Removes colored noise from the image
+
+
+
+
+ Calling Sequence
+
+ outputImage = denoiseColor(src, strengthFilter,strengthFilterColor, tempWindowSize, searchWindowSize)
+
+
+
+
+
+ Parameters
+
+ src :
+ The input image with colored noise.
+ strengthFilter :
+ The noise filter for white gaussian noise.
+ strengthFilterColor :
+ The noise filter for colored noise.
+ tempWindowSize :
+ Size in pixels of the template patch that is used to compute weights. Should be odd.
+ searchWindowSize :
+ Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+
+
+
+
+ Description
+
+The function is used to remove colored noise from an image. It is the modification of fasNlmeansDenoising function
+The output is a denoised image
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh Barik, NIT Rourkela
+
+
+
diff --git a/help/en_US/fastNlMeansDenoising.xml b/help/en_US/fastNlMeansDenoising.xml
new file mode 100644
index 0000000..37bafbd
--- /dev/null
+++ b/help/en_US/fastNlMeansDenoising.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+ fastNlMeansDenoising
+ Removes gaussian white noise from images
+
+
+
+
+ Calling Sequence
+
+ outputImage=fastNlMeansDenoising(src, strengthFilter, tempWindowSize, searchWindowSize, choice)
+
+
+
+
+
+ Parameters
+
+ src :
+ Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image.
+ strengthFilter :
+ Parameter regulating filter strength.
+ templateWindowSize :
+ Size in pixels of the template patch that is used to compute weights. Should be odd.
+ searchWindowSize :
+ Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+ choice :
+ Chooses the method
+
+
+
+
+ Description
+
+Perform image denoising using Non-local Means Denoising algorithm with several computational optimizations. Noise expected to be a gaussian white noise.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh, NIT Rourkela
+
+
+
diff --git a/help/en_US/findContours.xml b/help/en_US/findContours.xml
new file mode 100644
index 0000000..5a84e7d
--- /dev/null
+++ b/help/en_US/findContours.xml
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+ findContours
+ Finds contours in an image
+
+
+
+
+ Calling Sequence
+
+ outputMat = findContours(inputImage, Mode, method, point_x, point_y)
+
+
+
+
+
+ Parameters
+
+ inputImage :
+ The input image
+ Mode :
+ Contour retrieval mode (Enter 1 for CV_RETR_EXTERNAL, 2 for CV_RETR_LIST, 3 for CV_RETR_CCOMP, 4 for CV_RETR_TREE)
+ method :
+ Contour approximation method (Enter 1 for CV_CHAIN_APPROX_NONE, 2 for CV_CHAIN_APPROX_SIMPLE, 3 for CV_CHAIN_APPROX_TC89_L1, 4 for CV_CHAIN_APPROX_TC89_KCOS)
+ point_x :
+ x-coordinate for point offset
+ point_y :
+ y-coordinate for point offset
+
+
+
+
+ Description
+
+The function retrieves contours from the images using the algorithm [Suzuki85]. The contours are a useful tool for shape analysis and object detection and recognition.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Abhilasha Sancheti
+ Shubham Lohakare
+ Sukul Bagai
+
+
+
diff --git a/help/en_US/histeq.xml b/help/en_US/histeq.xml
new file mode 100644
index 0000000..455b596
--- /dev/null
+++ b/help/en_US/histeq.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ histeq
+ Equalizes the histogram of an image
+
+
+
+
+ Calling Sequence
+
+ outputImage = histeq (inputImage)
+
+
+
+
+
+ Parameters
+
+ inputImage :
+ The input image for which the histogram has to be equalised
+
+
+
+
+ Description
+
+The function equalizes the histogram of the input image using the following algorithm: 1. Calculate the histogram H for src. 2. Normalize the histogram so that the sum of histogram bins is 255. 3. Compute the integral of the histogram. 4. Transform the image using H' as a look-up table: dst(x,y) = H'(src(x,y)). The algorithm normalizes the brightness and increases the contrast of the image.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Priyanka Hiranandani, NIT Surat
+
+
+
diff --git a/help/en_US/imadd.xml b/help/en_US/imadd.xml
new file mode 100644
index 0000000..aaa4d44
--- /dev/null
+++ b/help/en_US/imadd.xml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+ imadd
+ Add the contents of 2 matrices or images and store it in another
+
+
+
+
+ Calling Sequence
+
+ outputMat = imadd(input1, input2)
+
+
+
+
+
+ Parameters
+
+ input1 :
+ First input matrix or an image
+ input2 :
+ Second input matrix or image
+
+
+
+
+ Description
+
+Z = imadd(X,Y) adds each element in array X with the corresponding element in array Y and returns the sum in the corresponding element of the output array Z. X and Y are real, nonsparse numeric arrays with the same size and class, or Y is a scalar double. Z has the same size and class as X, unless X is logical, in which case Z is double.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Tess Zacharias
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/imcomplement.xml b/help/en_US/imcomplement.xml
new file mode 100644
index 0000000..c4353c8
--- /dev/null
+++ b/help/en_US/imcomplement.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+ imcomplement
+ Computes the complement of the image
+
+
+
+
+ Calling Sequence
+
+ compMat = imcomplement(srcImg)
+
+
+
+
+
+ Parameters
+
+ srcImg :
+ Input image
+
+
+
+
+ Description
+
+In the complement of a binary image, zeros become ones and ones become zeros; black and white are reversed. In the complement of an intensity or RGB image, each pixel value is subtracted from the maximum pixel value supported by the class (or 1.0 for double-precision images) and the difference is used as the pixel value in the output image. In the output image, dark areas become lighter and light areas become darker.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Tess Zacharias
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/imcontour.xml b/help/en_US/imcontour.xml
new file mode 100644
index 0000000..3c6533e
--- /dev/null
+++ b/help/en_US/imcontour.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ imcontour
+ Draws a contour plot for the input image
+
+
+
+
+ Calling Sequence
+
+ contourMat = imcontour(srcImg)
+
+
+
+
+
+ Parameters
+
+ srcImg :
+ THe input image
+
+
+
+
+ Description
+
+The function draws contour outlines in the image.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Tess zacharias
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/imdecolor.xml b/help/en_US/imdecolor.xml
new file mode 100644
index 0000000..48d6b21
--- /dev/null
+++ b/help/en_US/imdecolor.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+ imdecolor
+ Decolors and color boosts an image giving 2 outputs for the same respectively.
+
+
+
+
+ Calling Sequence
+
+ [outImg1, outImg2] = imdecolor(srcImg1)
+
+
+
+
+
+ Parameters
+
+ srcImg1 :
+ It is a 3-channel input image.
+ outImg1 :
+ It is a grayscale image of the image passed as input.
+ outImg2 :
+ It is a color boosted image of the image passed as input.
+
+
+
+
+ Description
+
+This function is used to decolor an image and also add a boost to it's color
+The output are 2 images, one is a grayscale and the other is a color boosted image
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh, NIT Rourkela
+
+
+
diff --git a/help/en_US/imfill.xml b/help/en_US/imfill.xml
new file mode 100644
index 0000000..106c15d
--- /dev/null
+++ b/help/en_US/imfill.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+ imfill
+ Fills in the regions and holes in an image.
+
+
+
+
+ Calling Sequence
+
+ [outputImage] = imfill(srcImg)
+ [outputImage] = imfill(srcImg,locations)
+
+
+
+
+
+ Parameters
+
+ srcImg :
+ It is the input image
+ locations :
+ If locations is a P-by-1 vector, it contains the linear indices of starting locations. If locations is P-by-ndims(BW) matrix, each row contains the array indices of one of the starting locations.
+
+
+
+
+ Description
+
+The function performs a flood-fill operation on the pixels of the input image.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Vinay Bhat
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/iminpaint.xml b/help/en_US/iminpaint.xml
new file mode 100644
index 0000000..6c54ef6
--- /dev/null
+++ b/help/en_US/iminpaint.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ iminpaint
+ Inpaints the unwanted area in an image using the neighboring pixel points
+
+
+
+
+ Calling Sequence
+
+ pImg = iminpaint(srcImg1,maskedRectangle,radius,methodNum)
+
+
+
+
+
+ Parameters
+
+ srcImg :
+ It is the input image
+ maskedRectangle:
+ It is a vector of double used which contains the co-ordinates of the masking rectangle
+ radius :
+ Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.
+ methodNum :
+ Inpainting method that could be one of the following,INPAINT_NS Navier-Stokes based method or INPAINT_TELEA Method by Alexandru Telea
+
+
+
+
+ Description
+
+The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh, NIT Rourkela
+
+
+
diff --git a/help/en_US/immultiply.xml b/help/en_US/immultiply.xml
new file mode 100644
index 0000000..29895ad
--- /dev/null
+++ b/help/en_US/immultiply.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+ immultiply
+ Multiply the contents of 2 matrices and store it in another
+
+
+
+
+ Calling Sequence
+
+ multiplyMat = immultiply(input1, input2)
+
+
+
+
+
+ Parameters
+
+ input1 :
+ First input matrix or an image
+ input2 :
+ Second input matrix or image
+
+
+
+
+ Description
+
+p=immultiply(a,b) multiplies each of the element in the first argument's array with the corrresponding element in the second argument's array and the answer is stored in p.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Tess Zacharias
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/imrotate.xml b/help/en_US/imrotate.xml
new file mode 100644
index 0000000..08d66e0
--- /dev/null
+++ b/help/en_US/imrotate.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+ imrotate
+ Rotates an image by the specified angle
+
+
+
+
+ Calling Sequence
+
+ outputImage = imrotate(srcImg, angle)
+ outputImage = imrotate(srcImg, angle, BoundingBoxType)
+
+
+
+
+
+ Parameters
+
+ srcImg :
+ The input image which is to be rotated
+ angle :
+ The angle by which the image is to be rotated
+ BoundingBoxType :
+ The type of the bounding box for the image displayed, whether a cropped one or one displaying full image.
+
+
+
+
+ Description
+
+The function rotates the input image in the anticlockwise direction by the angle specified around the centre point of the image. The bounding box determines whether the complete image or a cropped image will be displayed based on the BoundingBoxType i.e. 'loose' will display the complete image and 'crop' will display the cropped image.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Priyanka Hiranandani, NIT Surat
+
+
+
diff --git a/help/en_US/imsubtract.xml b/help/en_US/imsubtract.xml
new file mode 100644
index 0000000..4a28c2e
--- /dev/null
+++ b/help/en_US/imsubtract.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+ imsubtract
+ Subtract the contents of 2 matrices or images and store it inn another
+
+
+
+
+ Calling Sequence
+
+ outputMat = imsubtract(input1, input2)
+
+
+
+
+
+ Parameters
+
+ input1 :
+ First input matrix or an image
+ input2 :
+ Second input matrix or image
+
+
+
+
+ Description
+
+p=imsubtract(a,b) subtracts each of the element in the first argument's array with the corrresponding element in the second argument's array and the answer is stored in p.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Tess Zacharias
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/integralImage.xml b/help/en_US/integralImage.xml
new file mode 100644
index 0000000..de48242
--- /dev/null
+++ b/help/en_US/integralImage.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+ integralImage
+ The function calculates the integral of the source image passed.
+
+
+
+
+ Calling Sequence
+
+ [outputImage,squaredImage,rotatedImage] = integralImage(srcImg)
+ [outputImage,squaredImage,rotatedImage] = integralImage(srcImg,method)
+
+
+
+
+
+ Parameters
+
+ srcImg :
+ The input image
+ method :
+ The type of output frame in which the image is to be returned. 'upright' gives the original output whereas 'rotated' gives the output rotated by 45 degrees.
+
+
+
+
+ Description
+
+The function can be used to calculate integral images for the provided input image. These integrals can be used to calculate the sum or mean or even standard deviation. It makes it feasible to apply fast blurring or fast block co-relation.
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Samiran Roy
+ Shubham Lohakare
+
+
+
diff --git a/help/en_US/multiDenoise.xml b/help/en_US/multiDenoise.xml
new file mode 100644
index 0000000..e7ca926
--- /dev/null
+++ b/help/en_US/multiDenoise.xml
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+ multiDenoise
+ Removes gaussian white noise from an image taking reference images of the same captured in small intervals
+
+
+
+
+ Calling Sequence
+
+ out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3)
+ out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3, srcImg4)
+ out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3, srcImg4, srcImg5)
+
+
+
+
+
+ Parameters
+
+ imgToDenoiseIndex :
+ Target image to denoise index in srcImgs sequence
+ temporalWindowSize :
+ Number of surrounding images to use for target image denoising. Should be odd.
+ filterStrength :
+ Parameter regulating filter strength. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
+ templateWindowSize :
+ Size in pixels of the template patch that is used to compute weights. Should be odd.
+ searchWindowSize :
+ Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+ n :
+ number of images passed.
+ choice :
+ chooses which type of method to use
+ srcImgs :
+ The input images which are passed. They are variable arguments.
+
+
+
+
+ Description
+
+Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period of time. It removes gaussian white noise.The output is a denoised image
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh, NIT Rourkela
+
+
+
diff --git a/help/en_US/multiDenoiseColor.xml b/help/en_US/multiDenoiseColor.xml
new file mode 100644
index 0000000..beb4ccd
--- /dev/null
+++ b/help/en_US/multiDenoiseColor.xml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+ multiDenoiseColor
+ Removes gaussian white noise from an image taking reference images of the same captured in small intervals
+
+
+
+
+ Calling Sequence
+
+ out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor,templateWindowSize, searchWindowSize, n, srcImg1, srcImg2, srcImg3)
+ out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize, n, srcImg1, srcImg2, srcImg3,srcImg4)
+ out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize, n,srcImg1, srcImg2, srcImg3,srcImg4,srcImg5)
+
+
+
+
+
+ Parameters
+
+ imgToDenoiseIndex :
+ Target image to denoise index in srcImgs sequence
+ temporalWindowSize :
+ Number of surrounding images to use for target image denoising. Should be odd.
+ filterStrength :
+ Parameter regulating filter strength. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
+ filterStrengthColor :
+ same as filterStrength but for color components of noise.
+ templateWindowSize :
+ Size in pixels of the template patch that is used to compute weights. Should be odd.
+ searchWindowSize :
+ Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+ n :
+ number of images passed.
+ srcImgs :
+ The input images which are passed. They are variable arguments.
+
+
+
+
+ Description
+
+Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period of time. It removes gaussian white noise.The output is a denoised image
+
+
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Examples
+
+
+
+
+ Authors
+
+ Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh, NIT Rourkela
+
+
+
diff --git a/help/en_US/scilab_en_US_help/adaptHistEq.html b/help/en_US/scilab_en_US_help/adaptHistEq.html
new file mode 100644
index 0000000..3448860
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/adaptHistEq.html
@@ -0,0 +1,86 @@
+
+
+ adaptHistEq
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > adaptHistEq
+
+
+ adaptHistEq
+
Performs Contrast Limited Adaptive Histogram Equalisation
+
+
+Calling Sequence
+
outputImage = adaptHistEq(inputImage)
+outputImage = adaptHistEq(inputImage, clip_limit)
+
+Parameters
+
- inputImage :
+
The input image on which histogram equalisation is to be implemented
+ - clip_limit :
+
The target hgram bins.
+
+Description
+
As an alternative to using histeq, you can perform contrast-limited adaptive histogram equalization (CLAHE) using the adapthisteq function. While histeq works on the entire image, adapthisteq operates on small regions in the image, called tiles. Each tile's contrast is enhanced, so that the histogram of the output region approximately matches a specified histogram. After performing the equalization, adapthisteq combines neighboring tiles using bilinear interpolation to eliminate artificially induced boundaries.
+
+
+Examples
+
a=imread("lena.jpeg");
+k=adaptHistEq(a); |  |  | |
+
+Examples
+
a=imread("photo.jpg");
+k=adaptHistEq(a,64); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Yash Balghat
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/boxfilter.html b/help/en_US/scilab_en_US_help/boxfilter.html
new file mode 100644
index 0000000..be5985d
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/boxfilter.html
@@ -0,0 +1,95 @@
+
+
+ boxfilter
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > boxfilter
+
+
+ boxfilter
+
Blurs an image using the box filter.
+
+
+Calling Sequence
+
outputImage = boxfilter(InputArraysrc, intddepth,size1x,size1y,pointx,pointy, bool_normalize)
+
+Parameters
+
- InputArraysrc :
+
Input image to be blurred
+ - intddepth :
+
The output image depth (-1 to use src.depth())
+ - size1x :
+
Width for the blurring kernel size
+ - size1y :
+
Height for the blurring kernel size
+ - pointx :
+
x-coordinate for anchor point (Default value -1)
+ - pointy :
+
y-coordinate for anchor point (Default value -1)
+ - bool_normalize :
+
flag, specifying whether the kernel is normalized by its area or not
+
+Description
+
Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on).
+
+
+Examples
+
a = imread("lena.jpeg");
+k=boxfilter(a,-1,40,80,-1,-1,"False"); |  |  | |
+
+Examples
+
a = imread("photo.jpg");
+k=boxfilter(a,-1,8,8,-1,-1,"True"); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Priyanka Hiranandani, NIT Surat
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/denoiseColor.html b/help/en_US/scilab_en_US_help/denoiseColor.html
new file mode 100644
index 0000000..690eaa6
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/denoiseColor.html
@@ -0,0 +1,100 @@
+
+
+ denoiseColor
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > denoiseColor
+
+
+ denoiseColor
+
Removes colored noise from the image
+
+
+Calling Sequence
+
outputImage = denoiseColor(src, strengthFilter,strengthFilterColor, tempWindowSize, searchWindowSize)
+
+Parameters
+
- src :
+
The input image with colored noise.
+ - strengthFilter :
+
The noise filter for white gaussian noise.
+ - strengthFilterColor :
+
The noise filter for colored noise.
+ - tempWindowSize :
+
Size in pixels of the template patch that is used to compute weights. Should be odd.
+ - searchWindowSize :
+
Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+
+Description
+
The function is used to remove colored noise from an image. It is the modification of fasNlmeansDenoising function
+The output is a denoised image
+
+
+Examples
+
a = imread("taj.jpg");
+strengthFilter = 200;
+strengthFilterColor = 40;
+tempWindowSize = 7;
+searchWindowSize =21;
+p = denoiseColor(a,strengthFilter,strengthFilterColor,tempWindowSize,searchWindowSize); |  |  | |
+
+Examples
+
a = imread("cnoise1.jpg");
+strengthFilter = 20;
+strengthFilterColor = 100;
+tempWindowSize = 7;
+searchWindowSize =21;
+p = denoiseColor(a,strengthFilter,strengthFilterColor,tempWindowSize,searchWindowSize); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Ashish Mantosh Barik, NIT Rourkela
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/fastNlMeansDenoising.html b/help/en_US/scilab_en_US_help/fastNlMeansDenoising.html
new file mode 100644
index 0000000..c7f7e88
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/fastNlMeansDenoising.html
@@ -0,0 +1,99 @@
+
+
+ fastNlMeansDenoising
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > fastNlMeansDenoising
+
+
+ fastNlMeansDenoising
+
Removes gaussian white noise from images
+
+
+Calling Sequence
+
outputImage=fastNlMeansDenoising(src, strengthFilter, tempWindowSize, searchWindowSize, choice)
+
+Parameters
+
- src :
+
Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image.
+ - strengthFilter :
+
Parameter regulating filter strength.
+ - templateWindowSize :
+
Size in pixels of the template patch that is used to compute weights. Should be odd.
+ - searchWindowSize :
+
Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+ - choice :
+
Chooses the method
+
+Description
+
Perform image denoising using Non-local Means Denoising algorithm with several computational optimizations. Noise expected to be a gaussian white noise.
+
+
+Examples
+
a = imread("man.jpg");
+strengthFilter = 30;
+tempWindowSize = 7;
+searchWindowSize = 40;
+choice=2;
+k = fastNlMeansDenoising(a, strengthFilter, tempWindowSize, searchWindowSize,choice); |  |  | |
+
+Examples
+
a = imread("noise.jpg");
+strengthFilter = 100;
+tempWindowSize = 7;
+searchWindowSize = 50;
+choice = 3;
+k = fastNlMeansDenoising(a, strengthFilter, tempWindowSize, searchWindowSize,choice); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Ashish Mantosh, NIT Rourkela
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/findContours.html b/help/en_US/scilab_en_US_help/findContours.html
new file mode 100644
index 0000000..43a5167
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/findContours.html
@@ -0,0 +1,96 @@
+
+
+ findContours
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > findContours
+
+
+ findContours
+
Finds contours in an image
+
+
+Calling Sequence
+
outputMat = findContours(inputImage, Mode, method, point_x, point_y)
+
+Parameters
+
- inputImage :
+
The input image
+ - Mode :
+
Contour retrieval mode (Enter 1 for CV_RETR_EXTERNAL, 2 for CV_RETR_LIST, 3 for CV_RETR_CCOMP, 4 for CV_RETR_TREE)
+ - method :
+
Contour approximation method (Enter 1 for CV_CHAIN_APPROX_NONE, 2 for CV_CHAIN_APPROX_SIMPLE, 3 for CV_CHAIN_APPROX_TC89_L1, 4 for CV_CHAIN_APPROX_TC89_KCOS)
+ - point_x :
+
x-coordinate for point offset
+ - point_y :
+
y-coordinate for point offset
+
+Description
+
The function retrieves contours from the images using the algorithm [Suzuki85]. The contours are a useful tool for shape analysis and object detection and recognition.
+
+
+Examples
+
a = imread("lena.jpeg");
+k = finContours(a,3,2,10,10); |  |  | |
+
+Examples
+
a = imread("photo.jpeg");
+k = findContours(a,1,1,40,60); |  |  | |
+
+Examples
+
a = imread("photo1.jpg");
+k = findContours(a,2,3,50,50); |  |  | |
+
+Authors
+
- Abhilasha Sancheti
+ - Shubham Lohakare
+ - Sukul Bagai
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/histeq.html b/help/en_US/scilab_en_US_help/histeq.html
new file mode 100644
index 0000000..c81d239
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/histeq.html
@@ -0,0 +1,90 @@
+
+
+ histeq
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > histeq
+
+
+ histeq
+
Equalizes the histogram of an image
+
+
+Calling Sequence
+
outputImage = histeq (inputImage)
+
+Parameters
+
- inputImage :
+
The input image for which the histogram has to be equalised
+
+Description
+
The function equalizes the histogram of the input image using the following algorithm: 1. Calculate the histogram H for src. 2. Normalize the histogram so that the sum of histogram bins is 255. 3. Compute the integral of the histogram. 4. Transform the image using H' as a look-up table: dst(x,y) = H'(src(x,y)). The algorithm normalizes the brightness and increases the contrast of the image.
+
+
+Examples
+
a = imread("lena.jpeg");
+k = histeq(a);
+imshow(k); |  |  | |
+
+Examples
+
a = imread("bryan.jpg");
+k = histeq(a);
+imshow(k); |  |  | |
+
+Examples
+
a = imread("photo.jpg");
+k = histeq(a);
+imshow(k); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Priyanka Hiranandani, NIT Surat
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imadd.html b/help/en_US/scilab_en_US_help/imadd.html
new file mode 100644
index 0000000..aa3865c
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imadd.html
@@ -0,0 +1,88 @@
+
+
+ imadd
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imadd
+
+
+ imadd
+
Add the contents of 2 matrices or images and store it in another
+
+
+Calling Sequence
+
outputMat = imadd(input1, input2)
+
+Parameters
+
- input1 :
+
First input matrix or an image
+ - input2 :
+
Second input matrix or image
+
+Description
+
Z = imadd(X,Y) adds each element in array X with the corresponding element in array Y and returns the sum in the corresponding element of the output array Z. X and Y are real, nonsparse numeric arrays with the same size and class, or Y is a scalar double. Z has the same size and class as X, unless X is logical, in which case Z is double.
+
+
+Examples
+
a = [1 5 6;4 2 3];
+b = [8 10 15;5 1 9];
+c = imadd(a,b); |  |  | |
+
+Examples
+
a = imread("lena.jpeg");
+b = imread("lena1.jpeg");
+c = imadd(a,b);
+imshow(c) |  |  | |
+
+Authors
+
- Tess Zacharias
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imcomplement.html b/help/en_US/scilab_en_US_help/imcomplement.html
new file mode 100644
index 0000000..56f1886
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imcomplement.html
@@ -0,0 +1,85 @@
+
+
+ imcomplement
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imcomplement
+
+
+ imcomplement
+
Computes the complement of the image
+
+
+Calling Sequence
+
compMat = imcomplement(srcImg)
+
+Parameters
+
- srcImg :
+
Input image
+
+Description
+
In the complement of a binary image, zeros become ones and ones become zeros; black and white are reversed. In the complement of an intensity or RGB image, each pixel value is subtracted from the maximum pixel value supported by the class (or 1.0 for double-precision images) and the difference is used as the pixel value in the output image. In the output image, dark areas become lighter and light areas become darker.
+
+
+Examples
+
a = imread("lena.jpeg");
+k = imcomplement(a);
+imshow(k) |  |  | |
+
+Examples
+
a = imread("photo1.jpg");
+k = imcomplement(a);
+imshow(k) |  |  | |
+
+Authors
+
- Tess Zacharias
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imcontour.html b/help/en_US/scilab_en_US_help/imcontour.html
new file mode 100644
index 0000000..0a55514
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imcontour.html
@@ -0,0 +1,90 @@
+
+
+ imcontour
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imcontour
+
+
+ imcontour
+
Draws a contour plot for the input image
+
+
+Calling Sequence
+
contourMat = imcontour(srcImg)
+
+Parameters
+
- srcImg :
+
THe input image
+
+Description
+
The function draws contour outlines in the image.
+
+
+Examples
+
a = imread("lena.jpeg");
+k = imcontour(a);
+imshow(k) |  |  | |
+
+Examples
+
a = imread("photo1.jpg");
+k = imcontour(a);
+imshow(k) |  |  | |
+
+Examples
+
a = imread("bryan.jpg");
+k = imcontour(a);
+imshow(k) |  |  | |
+
+Authors
+
- Tess zacharias
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imdecolor.html b/help/en_US/scilab_en_US_help/imdecolor.html
new file mode 100644
index 0000000..a991aa5
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imdecolor.html
@@ -0,0 +1,94 @@
+
+
+ imdecolor
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imdecolor
+
+
+ imdecolor
+
Decolors and color boosts an image giving 2 outputs for the same respectively.
+
+
+Calling Sequence
+
[outImg1, outImg2] = imdecolor(srcImg1)
+
+Parameters
+
- srcImg1 :
+
It is a 3-channel input image.
+ - outImg1 :
+
It is a grayscale image of the image passed as input.
+ - outImg2 :
+
It is a color boosted image of the image passed as input.
+
+Description
+
This function is used to decolor an image and also add a boost to it's color
+The output are 2 images, one is a grayscale and the other is a color boosted image
+
+
+Examples
+
var=imread("ImageName");
+[decoloredImage,colorBoostedImage] = imdecolor(var);
+PRESS ENTER
+imshow(decoloredImage); shows the decolored Image
+imshow(colorBoostedImage); shows the color boosted image |  |  | |
+
+Examples
+
a = imread("images.jpeg");
+[b, c] = imdecolor(a);
+PRESS ENTER
+imshow(b); shows the decolored Image
+imshow(c); shows the color boosted image |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Ashish Mantosh, NIT Rourkela
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imdivide.html b/help/en_US/scilab_en_US_help/imdivide.html
new file mode 100644
index 0000000..da42770
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imdivide.html
@@ -0,0 +1,92 @@
+
+
+ imdivide
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imdivide
+
+
+ imdivide
+
Divides one image with another or divide image by constant.
+
+
+Calling Sequence
+
outputMat = imdivide(input1, input2)
+
+Parameters
+
- input1 :
+
Image or an array
+ - input2 :
+
Image or an array of same size or a scalar
+
+Description
+
imdivide takes 2 inputs, either both images which should be of the same size or one image and another scalar which is used as the divisor. Also the inputs can be two arrays of the same size or one array and one scalar. The output is the quotient of the two.
+
+
+Examples
+
k = imread("lena.jpeg");
+p = imdivide(k,2);
+imshow(p); |  |  | |
+
+Examples
+
k = imread("photo.jpg");
+p = imdivide(k,0.8);
+imshow(p); |  |  | |
+
+Examples
+
a = [10 20;50 10];
+b = 5;
+p = imdivide(a,b); |  |  | |
+
+Authors
+
- Tess Zacharias
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imfill.html b/help/en_US/scilab_en_US_help/imfill.html
new file mode 100644
index 0000000..b8fd6e6
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imfill.html
@@ -0,0 +1,93 @@
+
+
+ imfill
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imfill
+
+
+ imfill
+
Fills in the regions and holes in an image.
+
+
+Calling Sequence
+
[outputImage] = imfill(srcImg)
+[outputImage] = imfill(srcImg,locations)
+
+Parameters
+
- srcImg :
+
It is the input image
+ - locations :
+
If locations is a P-by-1 vector, it contains the linear indices of starting locations. If locations is P-by-ndims(BW) matrix, each row contains the array indices of one of the starting locations.
+
+Description
+
The function performs a flood-fill operation on the pixels of the input image.
+
+
+Examples
+
k = imread("lena.jpeg");
+im = imfill(k, [1 1; 10 10; 11 12]);
+imshow(im); |  |  | |
+
+Examples
+
k = imread("lena1.jpeg");
+im = imfill(k, [1 1; 20 20; 11 12;50 50;]);
+imshow(im); |  |  | |
+
+Examples
+
k = imread("penguin.jpg");
+p = imfill(k);
+imshow(p); |  |  | |
+
+Authors
+
- Vinay Bhat
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/iminpaint.html b/help/en_US/scilab_en_US_help/iminpaint.html
new file mode 100644
index 0000000..a00b9e8
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/iminpaint.html
@@ -0,0 +1,95 @@
+
+
+ iminpaint
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > iminpaint
+
+
+ iminpaint
+
Inpaints the unwanted area in an image using the neighboring pixel points
+
+
+Calling Sequence
+
pImg = iminpaint(srcImg1,maskedRectangle,radius,methodNum)
+
+Parameters
+
- srcImg :
+
It is the input image
+ - maskedRectangle:
+
It is a vector of double used which contains the co-ordinates of the masking rectangle
+ - radius :
+
Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.
+ - methodNum :
+
Inpainting method that could be one of the following,INPAINT_NS Navier-Stokes based method or INPAINT_TELEA Method by Alexandru Telea
+
+Description
+
The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images.
+
+
+Examples
+
a = imread("p1.jpeg");
+b = [210,40,100,200];
+typeOfMethod = 2;
+radius = 50;
+c = iminpaint(a,b,radius,typeOfMethod); |  |  | |
+
+Examples
+
a = imread("orig.jpg");
+b = [100,157,120,150];
+typeOfMethod = 1;
+radius = 5;
+c = iminpaint(a,b,radius,typeOfMethod); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Ashish Mantosh, NIT Rourkela
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/immultiply.html b/help/en_US/scilab_en_US_help/immultiply.html
new file mode 100644
index 0000000..a8014ea
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/immultiply.html
@@ -0,0 +1,93 @@
+
+
+ immultiply
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > immultiply
+
+
+ immultiply
+
Multiply the contents of 2 matrices and store it in another
+
+
+Calling Sequence
+
multiplyMat = immultiply(input1, input2)
+
+Parameters
+
- input1 :
+
First input matrix or an image
+ - input2 :
+
Second input matrix or image
+
+Description
+
p=immultiply(a,b) multiplies each of the element in the first argument's array with the corrresponding element in the second argument's array and the answer is stored in p.
+
+
+Examples
+
a = imread("lena.jpeg");
+k = immultiply(a,2);
+imshow(k) |  |  | |
+
+Examples
+
a = imread("photo.jpg");
+k = immultiply(a,0.5);
+imshow(k) |  |  | |
+
+Examples
+
a = [1 2 3; 4 5 6];
+b = [10 20 30;10 20 30];
+k = immultiply(a,b);
+disp(k) |  |  | |
+
+Authors
+
- Tess Zacharias
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imrotate.html b/help/en_US/scilab_en_US_help/imrotate.html
new file mode 100644
index 0000000..7e73758
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imrotate.html
@@ -0,0 +1,95 @@
+
+
+ imrotate
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imrotate
+
+
+ imrotate
+
Rotates an image by the specified angle
+
+
+Calling Sequence
+
outputImage = imrotate(srcImg, angle)
+outputImage = imrotate(srcImg, angle, BoundingBoxType)
+
+Parameters
+
- srcImg :
+
The input image which is to be rotated
+ - angle :
+
The angle by which the image is to be rotated
+ - BoundingBoxType :
+
The type of the bounding box for the image displayed, whether a cropped one or one displaying full image.
+
+Description
+
The function rotates the input image in the anticlockwise direction by the angle specified around the centre point of the image. The bounding box determines whether the complete image or a cropped image will be displayed based on the BoundingBoxType i.e. 'loose' will display the complete image and 'crop' will display the cropped image.
+
+
+Examples
+
k = imread("lena.jpeg');
+p = imrotate(k, 45);
+imshow(p) |  |  | |
+
+Examples
+
k = imread("lena.jpeg');
+p = imrotate(k, 30, 'loose');
+imshow(p) |  |  | |
+
+Examples
+
k = imread("photo.jpg");
+p = imrotate(k, 60, 'crop');
+imshow(p) |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Priyanka Hiranandani, NIT Surat
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/imsubtract.html b/help/en_US/scilab_en_US_help/imsubtract.html
new file mode 100644
index 0000000..ec90ce3
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/imsubtract.html
@@ -0,0 +1,94 @@
+
+
+ imsubtract
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imsubtract
+
+
+ imsubtract
+
Subtract the contents of 2 matrices or images and store it inn another
+
+
+Calling Sequence
+
outputMat = imsubtract(input1, input2)
+
+Parameters
+
- input1 :
+
First input matrix or an image
+ - input2 :
+
Second input matrix or image
+
+Description
+
p=imsubtract(a,b) subtracts each of the element in the first argument's array with the corrresponding element in the second argument's array and the answer is stored in p.
+
+
+Examples
+
a = imread("lena.jpeg");
+k = imsubtract(a,50);
+imshow(k) |  |  | |
+
+Examples
+
a = imread("lena.jpeg");
+b = imread("lena1.jpeg"):
+k = imsubtract(a,b);
+imshow(k) |  |  | |
+
+Examples
+
a = [19 20 21;23 54 11];
+b = [9 10 11;3 34 -9];
+c = imsubtract(a,b);
+disp(c) |  |  | |
+
+Authors
+
- Tess Zacharias
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/integralImage.html b/help/en_US/scilab_en_US_help/integralImage.html
new file mode 100644
index 0000000..0915797
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/integralImage.html
@@ -0,0 +1,92 @@
+
+
+ integralImage
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > integralImage
+
+
+ integralImage
+
The function calculates the integral of the source image passed.
+
+
+Calling Sequence
+
[outputImage,squaredImage,rotatedImage] = integralImage(srcImg)
+[outputImage,squaredImage,rotatedImage] = integralImage(srcImg,method)
+
+Parameters
+
- srcImg :
+
The input image
+ - method :
+
The type of output frame in which the image is to be returned. 'upright' gives the original output whereas 'rotated' gives the output rotated by 45 degrees.
+
+Description
+
The function can be used to calculate integral images for the provided input image. These integrals can be used to calculate the sum or mean or even standard deviation. It makes it feasible to apply fast blurring or fast block co-relation.
+
+
+Examples
+
a = imread("lena.jpeg");
+[p, q, r] = integralImage(a);
+imshow(p);
+imshow(q);
+imshow(r); |  |  | |
+
+Examples
+
a = imread("lena1.jpeg");
+[p, q, r] = integralImage(a);
+imshow(p);
+imshow(q);
+imshow(r); |  |  | |
+
+Authors
+
- Samiran Roy
+ - Shubham Lohakare
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/multiDenoise.html b/help/en_US/scilab_en_US_help/multiDenoise.html
new file mode 100644
index 0000000..b421e9a
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/multiDenoise.html
@@ -0,0 +1,133 @@
+
+
+ multiDenoise
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > multiDenoise
+
+
+ multiDenoise
+
Removes gaussian white noise from an image taking reference images of the same captured in small intervals
+
+
+Calling Sequence
+
out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3)
+out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3, srcImg4)
+out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3, srcImg4, srcImg5)
+
+Parameters
+
- imgToDenoiseIndex :
+
Target image to denoise index in srcImgs sequence
+ - temporalWindowSize :
+
Number of surrounding images to use for target image denoising. Should be odd.
+ - filterStrength :
+
Parameter regulating filter strength. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
+ - templateWindowSize :
+
Size in pixels of the template patch that is used to compute weights. Should be odd.
+ - searchWindowSize :
+
Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+ - n :
+
number of images passed.
+ - choice :
+
chooses which type of method to use
+ - srcImgs :
+
The input images which are passed. They are variable arguments.
+
+Description
+
Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period of time. It removes gaussian white noise.The output is a denoised image
+
+
+Examples
+
a= imread("img1.jpg");
+b= imread("img2.jpg");
+c= imread("img3.jpg");
+imgToDenoiseIndex=1;
+temporalWindowSize =1;
+templateWindowSize =7;
+searchWindowSize =21;
+filterStrength = 10;
+n = 3;
+choice = 1;
+k=multiDenoise(imgToDenoiseIndex,temporalWindowSize,filterStrength,templateWindowSize,searchWindowSize,n,choice,a,b,c); |  |  | |
+
+Examples
+
a= imread("img1.jpg");
+b= imread("img2.jpg");
+c= imread("img3.jpg");
+d= imread("img4.jpg");
+imgToDenoiseIndex=1;
+temporalWindowSize =1;
+templateWindowSize =7;
+searchWindowSize =21;
+filterStrength = 100;
+n = 4;
+choice = 1;
+k=multiDenoise(imgToDenoiseIndex,temporalWindowSize,filterStrength,templateWindowSize,searchWindowSize,n,choice,a,b,c,d); |  |  | |
+
+Examples
+
a= imread("pic.jpeg");
+b= imread("pic1.jpeg");
+c= imread("pic2.jpeg");
+d= imread("pic3.jpeg");
+e= imread("pic4.jpeg");
+imgToDenoiseIndex=3;
+temporalWindowSize =3;
+templateWindowSize =7;
+searchWindowSize =21;
+filterStrength = 75;
+n = 5;
+choice = 2;
+k=multiDenoise(imgToDenoiseIndex,temporalWindowSize,filterStrength,templateWindowSize,searchWindowSize,n,choice,a,b,c,d,e); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Ashish Mantosh, NIT Rourkela
+
+
+
+
+
diff --git a/help/en_US/scilab_en_US_help/multiDenoiseColor.html b/help/en_US/scilab_en_US_help/multiDenoiseColor.html
new file mode 100644
index 0000000..5ad8371
--- /dev/null
+++ b/help/en_US/scilab_en_US_help/multiDenoiseColor.html
@@ -0,0 +1,133 @@
+
+
+ multiDenoiseColor
+
+
+
+
+
+
+
+ FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > multiDenoiseColor
+
+
+ multiDenoiseColor
+
Removes gaussian white noise from an image taking reference images of the same captured in small intervals
+
+
+Calling Sequence
+
out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor,templateWindowSize, searchWindowSize, n, srcImg1, srcImg2, srcImg3)
+out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize, n, srcImg1, srcImg2, srcImg3,srcImg4)
+out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize, n,srcImg1, srcImg2, srcImg3,srcImg4,srcImg5)
+
+Parameters
+
- imgToDenoiseIndex :
+
Target image to denoise index in srcImgs sequence
+ - temporalWindowSize :
+
Number of surrounding images to use for target image denoising. Should be odd.
+ - filterStrength :
+
Parameter regulating filter strength. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
+ - filterStrengthColor :
+
same as filterStrength but for color components of noise.
+ - templateWindowSize :
+
Size in pixels of the template patch that is used to compute weights. Should be odd.
+ - searchWindowSize :
+
Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+ - n :
+
number of images passed.
+ - srcImgs :
+
The input images which are passed. They are variable arguments.
+
+Description
+
Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period of time. It removes gaussian white noise.The output is a denoised image
+
+
+Examples
+
a= imread("img1.jpg");
+b= imread("img2.jpg");
+c= imread("img3.jpg");
+imgToDenoiseIndex=1;
+temporalWindowSize =1;
+templateWindowSize =7;
+searchWindowSize =21;
+filterStrength = 10;
+filterStrengthColor = 10;
+n = 3;
+k=multiDenoiseColor(imgToDenoiseIndex,temporalWindowSize,filterStrength,filterStrengthColor,templateWindowSize,searchWindowSize,n,a,b,c); |  |  | |
+
+Examples
+
a= imread("img1.jpg");
+b= imread("img2.jpg");
+c= imread("img3.jpg");
+d= imread("img4.jpg");
+imgToDenoiseIndex=1;
+temporalWindowSize =1;
+templateWindowSize =7;
+searchWindowSize =21;
+filterStrength = 100;
+filterStrengthColor=30;
+n = 4;
+choice = 1;
+k=multiDenoiseColor(imgToDenoiseIndex,temporalWindowSize,filterStrength,filterStrengthColor,templateWindowSize,searchWindowSize,n,a,b,c,d); |  |  | |
+
+Examples
+
a= imread("pic.jpeg");
+b= imread("pic1.jpeg");
+c= imread("pic2.jpeg");
+d= imread("pic3.jpeg");
+e= imread("pic4.jpeg");
+imgToDenoiseIndex=3;
+temporalWindowSize =3;
+templateWindowSize =7;
+searchWindowSize =21;
+filterStrength = 75;
+filterStrengthColor = 50;
+n = 5;
+choice = 2;
+k=multiDenoiseColor(imgToDenoiseIndex,temporalWindowSize,filterStrength,filterStrengthColor,templateWindowSize,searchWindowSize,n,a,b,c,d,e); |  |  | |
+
+Authors
+
- Shubham Lohakare, NITK Surathkal
+ - Ashish Mantosh, NIT Rourkela
+
+
+
+
+
diff --git a/images/apple.png b/images/apple.png
new file mode 100644
index 0000000..f473cb4
Binary files /dev/null and b/images/apple.png differ
diff --git a/images/b1.jpeg b/images/b1.jpeg
new file mode 100644
index 0000000..50c363d
Binary files /dev/null and b/images/b1.jpeg differ
diff --git a/images/b2.jpeg b/images/b2.jpeg
new file mode 100644
index 0000000..9ce3594
Binary files /dev/null and b/images/b2.jpeg differ
diff --git a/images/cnoise.jpeg b/images/cnoise.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/cnoise.jpeg differ
diff --git a/images/cnoise1.jpg b/images/cnoise1.jpg
new file mode 100644
index 0000000..aecc3d9
Binary files /dev/null and b/images/cnoise1.jpg differ
diff --git a/images/cnoise2.jpg b/images/cnoise2.jpg
new file mode 100644
index 0000000..aecc3d9
Binary files /dev/null and b/images/cnoise2.jpg differ
diff --git a/images/cnoise3.jpg b/images/cnoise3.jpg
new file mode 100644
index 0000000..aecc3d9
Binary files /dev/null and b/images/cnoise3.jpg differ
diff --git a/images/cnoise4.jpg b/images/cnoise4.jpg
new file mode 100644
index 0000000..aecc3d9
Binary files /dev/null and b/images/cnoise4.jpg differ
diff --git a/images/cnoise5.jpg b/images/cnoise5.jpg
new file mode 100644
index 0000000..aecc3d9
Binary files /dev/null and b/images/cnoise5.jpg differ
diff --git a/images/colnoise.jpeg b/images/colnoise.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/colnoise.jpeg differ
diff --git a/images/colnoise1.jpeg b/images/colnoise1.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/colnoise1.jpeg differ
diff --git a/images/colnoise2.jpeg b/images/colnoise2.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/colnoise2.jpeg differ
diff --git a/images/colnoise3.jpeg b/images/colnoise3.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/colnoise3.jpeg differ
diff --git a/images/colnoise4.jpeg b/images/colnoise4.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/colnoise4.jpeg differ
diff --git a/images/colnoise5.jpeg b/images/colnoise5.jpeg
new file mode 100644
index 0000000..662609d
Binary files /dev/null and b/images/colnoise5.jpeg differ
diff --git a/images/happy.jpg b/images/happy.jpg
new file mode 100644
index 0000000..3498267
Binary files /dev/null and b/images/happy.jpg differ
diff --git a/images/image1.jpg b/images/image1.jpg
new file mode 100644
index 0000000..daecd89
Binary files /dev/null and b/images/image1.jpg differ
diff --git a/images/image2.jpg b/images/image2.jpg
new file mode 100644
index 0000000..daecd89
Binary files /dev/null and b/images/image2.jpg differ
diff --git a/images/image3.jpg b/images/image3.jpg
new file mode 100644
index 0000000..daecd89
Binary files /dev/null and b/images/image3.jpg differ
diff --git a/images/image4.jpg b/images/image4.jpg
new file mode 100644
index 0000000..daecd89
Binary files /dev/null and b/images/image4.jpg differ
diff --git a/images/image5.jpg b/images/image5.jpg
new file mode 100644
index 0000000..daecd89
Binary files /dev/null and b/images/image5.jpg differ
diff --git a/images/images.jpeg b/images/images.jpeg
new file mode 100644
index 0000000..ef6ef47
Binary files /dev/null and b/images/images.jpeg differ
diff --git a/images/lena1.jpeg b/images/lena1.jpeg
new file mode 100644
index 0000000..fd086b5
Binary files /dev/null and b/images/lena1.jpeg differ
diff --git a/images/lena_noiseImg.jpg b/images/lena_noiseImg.jpg
new file mode 100644
index 0000000..daecd89
Binary files /dev/null and b/images/lena_noiseImg.jpg differ
diff --git a/images/man.jpg b/images/man.jpg
new file mode 100644
index 0000000..e05ffad
Binary files /dev/null and b/images/man.jpg differ
diff --git a/images/orig.jpg b/images/orig.jpg
new file mode 100644
index 0000000..cbe2efa
Binary files /dev/null and b/images/orig.jpg differ
diff --git a/images/photo.jpg b/images/photo.jpg
new file mode 100644
index 0000000..fdb63a1
Binary files /dev/null and b/images/photo.jpg differ
diff --git a/images/photo1.jpg b/images/photo1.jpg
new file mode 100644
index 0000000..5b95da4
Binary files /dev/null and b/images/photo1.jpg differ
diff --git a/images/taj.jpg b/images/taj.jpg
new file mode 100644
index 0000000..8230a7f
Binary files /dev/null and b/images/taj.jpg differ
diff --git a/images/water.jpg b/images/water.jpg
new file mode 100644
index 0000000..21d659a
Binary files /dev/null and b/images/water.jpg differ
diff --git a/macros/adaptHistEq.sci b/macros/adaptHistEq.sci
new file mode 100644
index 0000000..edc9af9
--- /dev/null
+++ b/macros/adaptHistEq.sci
@@ -0,0 +1,52 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Yash Balghat
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [outputImg]=adaptHistEq(inputImage,varargin)
+//Performs Contrast Limited Adaptive Histogram Equalisation
+//
+//Calling Sequence
+//outputImage = adaptHistEq(inputImage)
+//outputImage = adaptHistEq(inputImage, clip_limit)
+//
+//Parameters
+//inputImage : The input image on which histogram equalisation is to be implemented
+//clip_limit : The target hgram bins.
+//
+//Description
+//As an alternative to using histeq, you can perform contrast-limited adaptive histogram equalization (CLAHE) using the adapthisteq function. While histeq works on the entire image, adapthisteq operates on small regions in the image, called tiles. Each tile's contrast is enhanced, so that the histogram of the output region approximately matches a specified histogram. After performing the equalization, adapthisteq combines neighboring tiles using bilinear interpolation to eliminate artificially induced boundaries.
+//
+//Examples
+//a=imread("lena.jpeg");
+//k=adaptHistEq(a);
+//
+//Examples
+//a=imread("photo.jpg");
+//k=adaptHistEq(a,64);
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Yash Balghat
+
+ [lhs rhs]=argn(0);
+ if rhs>2
+ error(msprintf(" Too many input arguments"));
+ end
+ inputList=mattolist(inputImage);
+ select rhs
+ case 1 then
+ outputList=raw_adaptHistEq(inputList);
+ case 2 then
+ outputList=raw_adaptHistEq(inputList,varargin(1));
+ end
+ for i=1:size(outputList)
+ outputImg(:,:,i)=outputList(i)
+ end
+endfunction
diff --git a/macros/boxfilter.sci b/macros/boxfilter.sci
new file mode 100644
index 0000000..f1b4d27
--- /dev/null
+++ b/macros/boxfilter.sci
@@ -0,0 +1,50 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Yash Balghat
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out]=boxfilter(InputArraysrc, intddepth,size1x,size1y,pointx,pointy, bool_normalize)
+//Blurs an image using the box filter.
+//
+//Calling Sequence
+//outputImage = boxfilter(InputArraysrc, intddepth,size1x,size1y,pointx,pointy, bool_normalize)
+//
+//Parameters
+//InputArraysrc : Input image to be blurred
+//intddepth : The output image depth (-1 to use src.depth())
+//size1x : Width for the blurring kernel size
+//size1y : Height for the blurring kernel size
+//pointx : x-coordinate for anchor point (Default value -1)
+//pointy : y-coordinate for anchor point (Default value -1)
+//bool_normalize : flag, specifying whether the kernel is normalized by its area or not
+//
+//Description
+//Unnormalized box filter is useful for computing various integral characteristics over each pixel neighborhood, such as covariance matrices of image derivatives (used in dense optical flow algorithms, and so on).
+//
+//Examples
+//a = imread("lena.jpeg");
+//k=boxfilter(a,-1,40,80,-1,-1,"False");
+//
+//Examples
+//a = imread("photo.jpg");
+//k=boxfilter(a,-1,8,8,-1,-1,"True");
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Priyanka Hiranandani, NIT Surat
+
+
+ input_image1=mattolist(InputArraysrc)
+ a=raw_boxfilter(input_image1, intddepth,size1x,size1y,pointx,pointy, bool_normalize)
+ dimension=size(a)
+ for i = 1:dimension
+ out(:,:,i)=(a(i))
+ end
+
+endfunction
diff --git a/macros/denoiseColor.sci b/macros/denoiseColor.sci
new file mode 100644
index 0000000..2e66e19
--- /dev/null
+++ b/macros/denoiseColor.sci
@@ -0,0 +1,61 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Ashish Manatosh Barik
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out] = denoiseColor(src, strengthFilter,strengthFilterColor, tempWindowSize, searchWindowSize)
+//Removes colored noise from the image
+//
+//Calling Sequence
+//outputImage = denoiseColor(src, strengthFilter,strengthFilterColor, tempWindowSize, searchWindowSize)
+//
+//Parameters
+//src : The input image with colored noise.
+//strengthFilter : The noise filter for white gaussian noise.
+//strengthFilterColor : The noise filter for colored noise.
+//tempWindowSize : Size in pixels of the template patch that is used to compute weights. Should be odd.
+//searchWindowSize : Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+//
+//Description
+//The function is used to remove colored noise from an image. It is the modification of fasNlmeansDenoising function
+//The output is a denoised image
+//
+//Examples
+//a = imread("taj.jpg");
+//strengthFilter = 200;
+//strengthFilterColor = 40;
+//tempWindowSize = 7;
+//searchWindowSize =21;
+//p = denoiseColor(a,strengthFilter,strengthFilterColor,tempWindowSize,searchWindowSize);
+//
+//Examples
+//a = imread("cnoise1.jpg");
+//strengthFilter = 20;
+//strengthFilterColor = 100;
+//tempWindowSize = 7;
+//searchWindowSize =21;
+//p = denoiseColor(a,strengthFilter,strengthFilterColor,tempWindowSize,searchWindowSize);
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Ashish Mantosh Barik, NIT Rourkela
+
+ srcMat = mattolist(src)//Reading the image
+
+ output = raw_denoiseColor(srcMat, strengthFilter,strengthFilterColor, tempWindowSize, searchWindowSize)
+
+ channels = size(output)
+
+ for i = 1 : channels
+ out(:,:,i) = (output(i))
+ end
+ out = double(out)
+
+endfunction
+
diff --git a/macros/fastNlMeansDenoising.sci b/macros/fastNlMeansDenoising.sci
new file mode 100644
index 0000000..033a4f1
--- /dev/null
+++ b/macros/fastNlMeansDenoising.sci
@@ -0,0 +1,59 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Ashish Manatosh Barik
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out] = fastNlMeansDenoising(src, strengthFilter, tempWindowSize, searchWindowSize, choice)
+//Removes gaussian white noise from images
+//
+//Calling Sequence
+//outputImage=fastNlMeansDenoising(src, strengthFilter, tempWindowSize, searchWindowSize, choice)
+//
+//Parameters
+//src : Input 8-bit 1-channel, 2-channel, 3-channel or 4-channel image.
+//strengthFilter : Parameter regulating filter strength.
+//templateWindowSize : Size in pixels of the template patch that is used to compute weights. Should be odd.
+//searchWindowSize : Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+//choice : Chooses the method
+//
+//Description
+//Perform image denoising using Non-local Means Denoising algorithm with several computational optimizations. Noise expected to be a gaussian white noise.
+//
+//Examples
+//a = imread("man.jpg");
+//strengthFilter = 30;
+//tempWindowSize = 7;
+//searchWindowSize = 40;
+//choice=2;
+//k = fastNlMeansDenoising(a, strengthFilter, tempWindowSize, searchWindowSize,choice);
+//
+//Examples
+//a = imread("noise.jpg");
+//strengthFilter = 100;
+//tempWindowSize = 7;
+//searchWindowSize = 50;
+//choice = 3;
+//k = fastNlMeansDenoising(a, strengthFilter, tempWindowSize, searchWindowSize,choice);
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Ashish Mantosh, NIT Rourkela
+ srcMat = mattolist(src)
+
+ output = raw_fastNlMeansDenoising(srcMat, strengthFilter, tempWindowSize, searchWindowSize,choice)
+
+ channels = size(output)
+
+ for i = 1 : channels
+ out(:,:,i) = (output(i))
+ end
+ out = double(out)
+
+endfunction
+
diff --git a/macros/findContours.sci b/macros/findContours.sci
new file mode 100644
index 0000000..15e60c1
--- /dev/null
+++ b/macros/findContours.sci
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Abhilasha Sancheti, Shubham Lohakare, Sukul Bagai
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [outputMat]= findContours(inputImage, Mode, method, point_x, point_y)
+//Finds contours in an image
+//
+//Calling Sequence
+//outputMat = findContours(inputImage, Mode, method, point_x, point_y)
+//
+//Parameters
+//inputImage : The input image
+//Mode : Contour retrieval mode (Enter 1 for CV_RETR_EXTERNAL, 2 for CV_RETR_LIST, 3 for CV_RETR_CCOMP, 4 for CV_RETR_TREE)
+//method : Contour approximation method (Enter 1 for CV_CHAIN_APPROX_NONE, 2 for CV_CHAIN_APPROX_SIMPLE, 3 for CV_CHAIN_APPROX_TC89_L1, 4 for CV_CHAIN_APPROX_TC89_KCOS)
+//point_x : x-coordinate for point offset
+//point_y : y-coordinate for point offset
+//
+//Description
+//The function retrieves contours from the images using the algorithm [Suzuki85]. The contours are a useful tool for shape analysis and object detection and recognition.
+//
+//Examples
+//a = imread("lena.jpeg");
+//k = finContours(a,3,2,10,10);
+//
+//Examples
+//a = imread("photo.jpeg");
+//k = findContours(a,1,1,40,60);
+//
+//Examples
+//a = imread("photo1.jpg");
+//k = findContours(a,2,3,50,50);
+//
+//Authors
+//Abhilasha Sancheti
+//Shubham Lohakare
+//Sukul Bagai
+ inputList=mattolist(inputImage);
+ outputList=raw_findContours(inputList,Mode, method, point_x, point_y)
+ for i=1:size(outputList)
+ outputMat(:,:,i)=outputList(i)
+ end
+endfunction
diff --git a/macros/histeq.sci b/macros/histeq.sci
new file mode 100644
index 0000000..9a6f4b6
--- /dev/null
+++ b/macros/histeq.sci
@@ -0,0 +1,49 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Priyanka Hiranandani, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out]=histeq(src)
+//Equalizes the histogram of an image
+//
+//Calling Sequence
+//outputImage = histeq (inputImage)
+//
+//Parameters
+//inputImage : The input image for which the histogram has to be equalised
+//
+//Description
+//The function equalizes the histogram of the input image using the following algorithm: 1. Calculate the histogram H for src. 2. Normalize the histogram so that the sum of histogram bins is 255. 3. Compute the integral of the histogram. 4. Transform the image using H' as a look-up table: dst(x,y) = H'(src(x,y)). The algorithm normalizes the brightness and increases the contrast of the image.
+//
+//Examples
+//a = imread("lena.jpeg");
+//k = histeq(a);
+//imshow(k);
+//
+//Examples
+//a = imread("bryan.jpg");
+//k = histeq(a);
+//imshow(k);
+//
+//Examples
+//a = imread("photo.jpg");
+//k = histeq(a);
+//imshow(k);
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Priyanka Hiranandani, NIT Surat
+ srcMat=mattolist(src)
+ output=raw_histeq(srcMat)
+ channels = size(output)
+ for i = 1: channels
+ out(:,:,i)=(output(i))
+ end
+ out = double(out)
+endfunction;
diff --git a/macros/imadd.sci b/macros/imadd.sci
new file mode 100644
index 0000000..66aaaa6
--- /dev/null
+++ b/macros/imadd.sci
@@ -0,0 +1,51 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Tess Zacharias, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out] = imadd(srcImg1, srcImg2)
+//Add the contents of 2 matrices or images and store it in another
+//
+//Calling Sequence
+//outputMat = imadd(input1, input2)
+//
+//Parameters
+//input1 : First input matrix or an image
+//input2 : Second input matrix or image
+//
+//Description
+//Z = imadd(X,Y) adds each element in array X with the corresponding element in array Y and returns the sum in the corresponding element of the output array Z. X and Y are real, nonsparse numeric arrays with the same size and class, or Y is a scalar double. Z has the same size and class as X, unless X is logical, in which case Z is double.
+//
+//Examples
+//a = [1 5 6;4 2 3];
+//b = [8 10 15;5 1 9];
+//c = imadd(a,b);
+//
+//Examples
+//a = imread("lena.jpeg");
+//b = imread("lena1.jpeg");
+//c = imadd(a,b);
+//imshow(c)
+//
+//Authors
+//Tess Zacharias
+//Shubham Lohakare
+
+ srcMat1=mattolist(srcImg1)
+ srcMat2=mattolist(srcImg2)
+
+ output = raw_imadd(srcMat1, srcMat2)
+ channels = size(output)
+
+ for i = 1: channels
+ out(:,:,i)= (output(i))
+ end
+ out=double(out)
+
+endfunction
diff --git a/macros/imcomplement.sci b/macros/imcomplement.sci
new file mode 100644
index 0000000..3e4cef0
--- /dev/null
+++ b/macros/imcomplement.sci
@@ -0,0 +1,47 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Tess Zacharias, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [compMat] = imcomplement(srcImg)
+//Computes the complement of the image
+//
+//Calling Sequence
+//compMat = imcomplement(srcImg)
+//
+//Parameters
+//srcImg : Input image
+//
+//Description
+//In the complement of a binary image, zeros become ones and ones become zeros; black and white are reversed. In the complement of an intensity or RGB image, each pixel value is subtracted from the maximum pixel value supported by the class (or 1.0 for double-precision images) and the difference is used as the pixel value in the output image. In the output image, dark areas become lighter and light areas become darker.
+//
+//Examples
+//a = imread("lena.jpeg");
+//k = imcomplement(a);
+//imshow(k)
+//
+//Examples
+//a = imread("photo1.jpg");
+//k = imcomplement(a);
+//imshow(k)
+//
+//Authors
+//Tess Zacharias
+//Shubham Lohakare
+ srcMat = mattolist(srcImg)
+
+ out = raw_imcomplement(srcMat)
+
+ ch = size(out)
+
+ for i=1:ch
+ compMat(:,:,i) = out(i)
+ end
+
+endfunction
diff --git a/macros/imcontour.sci b/macros/imcontour.sci
new file mode 100644
index 0000000..ad26ff7
--- /dev/null
+++ b/macros/imcontour.sci
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Tess Zacharias
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [contourMat] = imcontour(matA)
+//Draws a contour plot for the input image
+//
+//Calling Sequence
+//contourMat = imcontour(srcImg)
+//
+//Parameters
+//srcImg : THe input image
+//
+//Description
+//The function draws contour outlines in the image.
+//
+//Examples
+//a = imread("lena.jpeg");
+//k = imcontour(a);
+//imshow(k)
+//
+//Examples
+//a = imread("photo1.jpg");
+//k = imcontour(a);
+//imshow(k)
+//
+//Examples
+//a = imread("bryan.jpg");
+//k = imcontour(a);
+//imshow(k)
+//
+//Authors
+//Tess zacharias
+//Shubham Lohakare
+ srcMat = mattolist(matA)
+
+ out = raw_imcontour(srcMat)
+
+ ch = size(out)
+
+ for i=1:ch
+ contourMat(:,:,i) = out(i)
+ end
+
+
+endfunction
diff --git a/macros/imdecolor.sci b/macros/imdecolor.sci
new file mode 100644
index 0000000..73c0a99
--- /dev/null
+++ b/macros/imdecolor.sci
@@ -0,0 +1,60 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Ashish Manatosh Barik
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [outImg1, outImg2] = imdecolor(srcImg1)
+//Decolors and color boosts an image giving 2 outputs for the same respectively.
+//
+//Calling Sequence
+//[outImg1, outImg2] = imdecolor(srcImg1)
+//
+//Parameters
+//srcImg1 : It is a 3-channel input image.
+//outImg1 : It is a grayscale image of the image passed as input.
+//outImg2 : It is a color boosted image of the image passed as input.
+//
+//Description
+//This function is used to decolor an image and also add a boost to it's color
+//The output are 2 images, one is a grayscale and the other is a color boosted image
+//
+//Examples
+//var=imread("ImageName");
+//[decoloredImage,colorBoostedImage] = imdecolor(var);
+//PRESS ENTER
+//imshow(decoloredImage); shows the decolored Image
+//imshow(colorBoostedImage); shows the color boosted image
+//
+//Examples
+//a = imread("images.jpeg");
+//[b, c] = imdecolor(a);
+//PRESS ENTER
+//imshow(b); shows the decolored Image
+//imshow(c); shows the color boosted image
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Ashish Mantosh, NIT Rourkela
+ srcMat1 = mattolist(srcImg1)
+
+
+ [out1, out2] = raw_imdecolor(srcMat1)
+
+ channels1 = size(out1)
+ channels2 = size(out2)
+
+ for i = 1:channels1
+ outImg1(:, :, i) = (out1(i))
+ end
+
+ for j = 1:channels2
+ outImg2(:, :, j) = (out2(j))
+ end
+
+endfunction
diff --git a/macros/imdivide.sci b/macros/imdivide.sci
new file mode 100644
index 0000000..091df7a
--- /dev/null
+++ b/macros/imdivide.sci
@@ -0,0 +1,54 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Tess Zacharias, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out] = imdivide(srcImg1, srcImg2)
+// Divides one image with another or divide image by constant.
+//
+//Calling Sequence
+//outputMat = imdivide(input1, input2)
+//
+//Parameters
+//input1 : Image or an array
+//input2 : Image or an array of same size or a scalar
+//
+//Description
+//imdivide takes 2 inputs, either both images which should be of the same size or one image and another scalar which is used as the divisor. Also the inputs can be two arrays of the same size or one array and one scalar. The output is the quotient of the two.
+//
+//Examples
+//k = imread("lena.jpeg");
+//p = imdivide(k,2);
+//imshow(p);
+//
+//Examples
+//k = imread("photo.jpg");
+//p = imdivide(k,0.8);
+//imshow(p);
+//
+//Examples
+//a = [10 20;50 10];
+//b = 5;
+//p = imdivide(a,b);
+//
+//Authors
+//Tess Zacharias
+//Shubham Lohakare
+ srcMat1=mattolist(srcImg1)
+ srcMat2=mattolist(srcImg2)
+
+ output=raw_imdivide(srcMat1, srcMat2)
+
+ channels = size(output)
+
+ for i = 1: channels
+ out(:,:,i)=(output(i))
+ end
+ out = double(out)
+endfunction;
diff --git a/macros/imfill.sci b/macros/imfill.sci
new file mode 100644
index 0000000..2b11f48
--- /dev/null
+++ b/macros/imfill.sci
@@ -0,0 +1,61 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Vinay Bhat, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [dstMat] = imfill(srcImg, varargin)
+//Fills in the regions and holes in an image.
+//
+//Calling Sequence
+//[outputImage] = imfill(srcImg)
+//[outputImage] = imfill(srcImg,locations)
+//
+//Parameters
+//srcImg : It is the input image
+//locations : If locations is a P-by-1 vector, it contains the linear indices of starting locations. If locations is P-by-ndims(BW) matrix, each row contains the array indices of one of the starting locations.
+//
+//Description
+//The function performs a flood-fill operation on the pixels of the input image.
+//
+//Examples
+//k = imread("lena.jpeg");
+//im = imfill(k, [1 1; 10 10; 11 12]);
+//imshow(im);
+//
+//Examples
+//k = imread("lena1.jpeg");
+//im = imfill(k, [1 1; 20 20; 11 12;50 50;]);
+//imshow(im);
+//
+//Examples
+//k = imread("penguin.jpg");
+//p = imfill(k);
+//imshow(p);
+//
+//Authors
+//Vinay Bhat
+//Shubham Lohakare
+ [lhs, rhs] = argn(0)
+
+ srcMat = mattolist(srcImg)
+
+ select rhs
+ case 1 then
+ out = raw_imfill(srcMat)
+ case 2 then
+ out = raw_imfill(srcMat, varargin(1))
+ end
+
+ channel = size(out)
+
+ for i = 1: channel
+ dstMat(:,:,i) = out(i)
+ end
+
+endfunction
diff --git a/macros/iminpaint.sci b/macros/iminpaint.sci
new file mode 100644
index 0000000..c98e96b
--- /dev/null
+++ b/macros/iminpaint.sci
@@ -0,0 +1,54 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Ashish Manatosh Barik
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [pImg] = iminpaint(srcImg1,mask,radius,methodNum)
+//Inpaints the unwanted area in an image using the neighboring pixel points
+//
+//Calling Sequence
+//pImg = iminpaint(srcImg1,maskedRectangle,radius,methodNum)
+//
+//Parameters
+//srcImg : It is the input image
+//maskedRectangle: It is a vector of double used which contains the co-ordinates of the masking rectangle
+//radius : Radius of a circular neighborhood of each point inpainted that is considered by the algorithm.
+//methodNum : Inpainting method that could be one of the following,INPAINT_NS Navier-Stokes based method or INPAINT_TELEA Method by Alexandru Telea
+//
+//Description
+//The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images.
+//
+//Examples
+//a = imread("p1.jpeg");
+//b = [210,40,100,200];
+//typeOfMethod = 2;
+//radius = 50;
+//c = iminpaint(a,b,radius,typeOfMethod);
+//
+//Examples
+//a = imread("orig.jpg");
+//b = [100,157,120,150];
+//typeOfMethod = 1;
+//radius = 5;
+//c = iminpaint(a,b,radius,typeOfMethod);
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Ashish Mantosh, NIT Rourkela
+ srcMat1 = mattolist(srcImg1)
+ srcMat2 = mattolist(mask)
+ out=raw_iminpaint(srcMat1,srcMat2,radius,methodNum)
+
+ channels = size(out)
+
+ for i = 1 : channels
+ pImg(:,:,i) = (out(i))
+ end
+ pImg = double(pImg)
+endfunction
diff --git a/macros/immultiply.sci b/macros/immultiply.sci
new file mode 100644
index 0000000..a64f97e
--- /dev/null
+++ b/macros/immultiply.sci
@@ -0,0 +1,53 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Tess Zacharias, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [multiplyMat] = immultiply(srcImg1, srcImg2)
+//Multiply the contents of 2 matrices and store it in another
+//
+//Calling Sequence
+//multiplyMat = immultiply(input1, input2)
+//
+//Parameters
+//input1 : First input matrix or an image
+//input2 : Second input matrix or image
+//
+//Description
+//p=immultiply(a,b) multiplies each of the element in the first argument's array with the corrresponding element in the second argument's array and the answer is stored in p.
+//
+//Examples
+//a = imread("lena.jpeg");
+//k = immultiply(a,2);
+//imshow(k)
+//
+//Examples
+//a = imread("photo.jpg");
+//k = immultiply(a,0.5);
+//imshow(k)
+//
+//Examples
+//a = [1 2 3; 4 5 6];
+//b = [10 20 30;10 20 30];
+//k = immultiply(a,b);
+//disp(k)
+//
+//Authors
+//Tess Zacharias
+//Shubham Lohakare
+ srcMat1=mattolist(srcImg1)
+ srcMat2=mattolist(srcImg2)
+ out = raw_immultiply(srcMat1, srcMat2)
+
+ channel = size(out)
+
+ for i = 1: channel
+ multiplyMat(:,:,i) = out(i)
+ end
+endfunction
diff --git a/macros/imrotate.sci b/macros/imrotate.sci
new file mode 100644
index 0000000..e0893d7
--- /dev/null
+++ b/macros/imrotate.sci
@@ -0,0 +1,70 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Priyanka Hiranandani
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out] = imrotate(srcImg, angle, varargin)
+//Rotates an image by the specified angle
+//
+//Calling Sequence
+//outputImage = imrotate(srcImg, angle)
+//outputImage = imrotate(srcImg, angle, BoundingBoxType)
+//
+//Parameters
+//srcImg : The input image which is to be rotated
+//angle : The angle by which the image is to be rotated
+//BoundingBoxType : The type of the bounding box for the image displayed, whether a cropped one or one displaying full image.
+//
+//Description
+//The function rotates the input image in the anticlockwise direction by the angle specified around the centre point of the image. The bounding box determines whether the complete image or a cropped image will be displayed based on the BoundingBoxType i.e. 'loose' will display the complete image and 'crop' will display the cropped image.
+//
+//Examples
+//k = imread("lena.jpeg');
+//p = imrotate(k, 45);
+//imshow(p)
+//
+//Examples
+//k = imread("lena.jpeg');
+//p = imrotate(k, 30, 'loose');
+//imshow(p)
+//
+//Examples
+//k = imread("photo.jpg");
+//p = imrotate(k, 60, 'crop');
+//imshow(p)
+//
+//Authors
+//Shubham Lohakare, NITK Surathkal
+//Priyanka Hiranandani, NIT Surat
+srcMat = mattolist(srcImg)
+
+ [lhs, rhs] = argn(0)
+
+ if rhs > 3 then
+ error(msprintf("Too many input arguments"))
+ end
+ if lhs > 1 then
+ error(msprintf("Too many output arguments"))
+ end
+
+
+ select rhs
+ case 2 then
+ output = raw_imrotate(srcMat,angle)
+ case 3 then
+ output = raw_imrotate(srcMat, angle,varargin(1))
+ end
+
+ channels = size(output)
+ for i = 1: channels
+ out(:,:,i) = (output(i))
+ end
+ out = double(out)
+
+endfunction
diff --git a/macros/imsubtract.sci b/macros/imsubtract.sci
new file mode 100644
index 0000000..abd79a3
--- /dev/null
+++ b/macros/imsubtract.sci
@@ -0,0 +1,56 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Tess Zacharias, Shubham Lohakare
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [out] = imsubtract(srcImg1, srcImg2)
+//Subtract the contents of 2 matrices or images and store it inn another
+//
+//Calling Sequence
+//outputMat = imsubtract(input1, input2)
+//
+//Parameters
+//input1 : First input matrix or an image
+//input2 : Second input matrix or image
+//
+//Description
+//p=imsubtract(a,b) subtracts each of the element in the first argument's array with the corrresponding element in the second argument's array and the answer is stored in p.
+//
+//Examples
+//a = imread("lena.jpeg");
+//k = imsubtract(a,50);
+//imshow(k)
+//
+//Examples
+//a = imread("lena.jpeg");
+//b = imread("lena1.jpeg"):
+//k = imsubtract(a,b);
+//imshow(k)
+//
+//Examples
+//a = [19 20 21;23 54 11];
+//b = [9 10 11;3 34 -9];
+//c = imsubtract(a,b);
+//disp(c)
+//
+//Authors
+//Tess Zacharias
+//Shubham Lohakare
+ srcMat1=mattolist(srcImg1)
+ srcMat2=mattolist(srcImg2)
+
+ output = raw_imsubtract(srcMat1, srcMat2)
+ channels = size(output)
+
+ for i = 1: channels
+ out(:,:,i)= (output(i))
+ end
+ out=double(out)
+
+endfunction
diff --git a/macros/ind2gray.sci b/macros/ind2gray.sci
new file mode 100644
index 0000000..8869d81
--- /dev/null
+++ b/macros/ind2gray.sci
@@ -0,0 +1,11 @@
+function [output] = ind2gray(srcImg,choice)
+ srcMat = mattolist(srcImg)
+
+ out = raw_ind2gray(srcMat,choice)
+
+ channel = size(out)
+
+ for i = 1: channel
+ output(:,:,i) = out(i)
+ end
+endfunction
diff --git a/macros/ind2rgb.sci b/macros/ind2rgb.sci
new file mode 100644
index 0000000..c7208a2
--- /dev/null
+++ b/macros/ind2rgb.sci
@@ -0,0 +1,11 @@
+function [output] = ind2rgb(srcImg,choice)
+ srcMat = mattolist(srcImg)
+
+ out = raw_ind2rgb(srcMat,choice)
+
+ channel = size(out)
+
+ for i = 1: channel
+ output(:,:,i) = out(i)
+ end
+endfunction
diff --git a/macros/integralImage.bin b/macros/integralImage.bin
deleted file mode 100644
index 38b5e6c..0000000
Binary files a/macros/integralImage.bin and /dev/null differ
diff --git a/macros/integralImage.sci b/macros/integralImage.sci
deleted file mode 100644
index 00801cb..0000000
--- a/macros/integralImage.sci
+++ /dev/null
@@ -1,20 +0,0 @@
-function[dstMat] = integralImage(srcImg, varargin)
-
- [lhs, rhs] = argn(0)
-
- srcMat = mattolist(srcImg)
-
- select rhs
- case 1 then
- out = opencv_integralImage(srcMat)
- case 3 then
- out = opencv_integralImage(srcMat, varargin(1))
- end
-
- channel = size(out)
-
- for i = 1: channel
- dstMat(:,:,i) = out(i)
- end
-
-endfunction
diff --git a/macros/multiDenoise.sci b/macros/multiDenoise.sci
new file mode 100644
index 0000000..c50dfd4
--- /dev/null
+++ b/macros/multiDenoise.sci
@@ -0,0 +1,104 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Ashish Manatosh Barik
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [denoise] = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n,choice, varargin)
+// Removes gaussian white noise from an image taking reference images of the same captured in small intervals
+//
+// Calling Sequence
+// out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3)
+// out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3, srcImg4)
+// out = multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, srcImg1, srcImg2, srcImg3, srcImg4, srcImg5)
+//
+// Parameters
+// imgToDenoiseIndex : Target image to denoise index in srcImgs sequence
+// temporalWindowSize : Number of surrounding images to use for target image denoising. Should be odd.
+// filterStrength : Parameter regulating filter strength. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
+// templateWindowSize : Size in pixels of the template patch that is used to compute weights. Should be odd.
+// searchWindowSize : Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+// n : number of images passed.
+// choice : chooses which type of method to use
+// srcImgs : The input images which are passed. They are variable arguments.
+//
+// Description
+// Modification of fastNlMeansDenoising function for images sequence where consequtive images have been captured in small period of time. It removes gaussian white noise.The output is a denoised image
+//
+// Examples
+// a= imread("img1.jpg");
+// b= imread("img2.jpg");
+// c= imread("img3.jpg");
+// imgToDenoiseIndex=1;
+// temporalWindowSize =1;
+// templateWindowSize =7;
+// searchWindowSize =21;
+// filterStrength = 10;
+// n = 3;
+// choice = 1;
+// k=multiDenoise(imgToDenoiseIndex,temporalWindowSize,filterStrength,templateWindowSize,searchWindowSize,n,choice,a,b,c);
+//
+// Examples
+// a= imread("img1.jpg");
+// b= imread("img2.jpg");
+// c= imread("img3.jpg");
+// d= imread("img4.jpg");
+// imgToDenoiseIndex=1;
+// temporalWindowSize =1;
+// templateWindowSize =7;
+// searchWindowSize =21;
+// filterStrength = 100;
+// n = 4;
+// choice = 1;
+// k=multiDenoise(imgToDenoiseIndex,temporalWindowSize,filterStrength,templateWindowSize,searchWindowSize,n,choice,a,b,c,d);
+//
+// Examples
+// a= imread("pic.jpeg");
+// b= imread("pic1.jpeg");
+// c= imread("pic2.jpeg");
+// d= imread("pic3.jpeg");
+// e= imread("pic4.jpeg");
+// imgToDenoiseIndex=3;
+// temporalWindowSize =3;
+// templateWindowSize =7;
+// searchWindowSize =21;
+// filterStrength = 75;
+// n = 5;
+// choice = 2;
+// k=multiDenoise(imgToDenoiseIndex,temporalWindowSize,filterStrength,templateWindowSize,searchWindowSize,n,choice,a,b,c,d,e);
+//
+// Authors
+// Shubham Lohakare, NITK Surathkal
+// Ashish Mantosh, NIT Rourkela
+ [lhs, rhs] = argn(0)
+
+ select rhs
+ case 10 then
+ for i = 1:n
+ varargin(i) = mattolist(varargin(i))
+ end
+ out = raw_multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, varargin(1), varargin(2), varargin(3))
+ case 11 then
+ for i = 1:n
+ varargin(i) = mattolist(varargin(i))
+ end
+ out = raw_multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, varargin(1), varargin(2), varargin(3), varargin(4))
+ case 12 then
+ for i = 1:n
+ varargin(i) = mattolist(varargin(i))
+ end
+ out = raw_multiDenoise(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, choice, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5))
+ end
+
+ channel = size(out)
+
+ for i= 1: channel
+ denoise(:,:,i) = (out(i))
+ end
+
+endfunction
diff --git a/macros/multiDenoiseColor.sci b/macros/multiDenoiseColor.sci
new file mode 100644
index 0000000..34b04ba
--- /dev/null
+++ b/macros/multiDenoiseColor.sci
@@ -0,0 +1,106 @@
+// Copyright (C) 2015 - IIT Bombay - FOSSEE
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+// Author: Shubham Lohakare, Ashish Manatosh Barik
+// Organization: FOSSEE, IIT Bombay
+// Email: toolbox@scilab.in
+//
+function [denoise] = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor, templateWindowSize, searchWindowSize, n,varargin)
+// Removes colored noise from an image taking reference images of the same captured in small intervals
+//
+// Calling Sequence
+// out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor,templateWindowSize, searchWindowSize, n, srcImg1, srcImg2, srcImg3)
+// out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize, n, srcImg1, srcImg2, srcImg3,srcImg4)
+// out = multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize, n,srcImg1, srcImg2, srcImg3,srcImg4,srcImg5)
+//
+// Parameters
+// imgToDenoiseIndex : Target image to denoise index in srcImgs sequence
+// temporalWindowSize : Number of surrounding images to use for target image denoising. Should be odd.
+// filterStrength : Parameter regulating filter strength. Bigger h value perfectly removes noise but also removes image details, smaller h value preserves details but also preserves some noise.
+// filterStrengthColor : same as filterStrength but for color components of noise.
+// templateWindowSize : Size in pixels of the template patch that is used to compute weights. Should be odd.
+// searchWindowSize : Size in pixels of the window that is used to compute weighted average for given pixel. Should be odd.
+// n : number of images passed.
+// srcImgs : The input images which are passed. They are variable arguments.
+//
+// Description
+// Modification of denoiseColor function for images sequence where consequtive images have been captured in small period of time. It removes colored noise.The output is a denoised image
+//
+// Examples
+// a= imread("img1.jpg");
+// b= imread("img2.jpg");
+// c= imread("img3.jpg");
+// imgToDenoiseIndex=1;
+// temporalWindowSize =1;
+// templateWindowSize =7;
+// searchWindowSize =21;
+// filterStrength = 10;
+// filterStrengthColor = 10;
+// n = 3;
+// k=multiDenoiseColor(imgToDenoiseIndex,temporalWindowSize,filterStrength,filterStrengthColor,templateWindowSize,searchWindowSize,n,a,b,c);
+//
+// Examples
+// a= imread("img1.jpg");
+// b= imread("img2.jpg");
+// c= imread("img3.jpg");
+// d= imread("img4.jpg");
+// imgToDenoiseIndex=1;
+// temporalWindowSize =1;
+// templateWindowSize =7;
+// searchWindowSize =21;
+// filterStrength = 100;
+//filterStrengthColor=30;
+// n = 4;
+// choice = 1;
+// k=multiDenoiseColor(imgToDenoiseIndex,temporalWindowSize,filterStrength,filterStrengthColor,templateWindowSize,searchWindowSize,n,a,b,c,d);
+//
+// Examples
+// a= imread("pic.jpeg");
+// b= imread("pic1.jpeg");
+// c= imread("pic2.jpeg");
+// d= imread("pic3.jpeg");
+// e= imread("pic4.jpeg");
+// imgToDenoiseIndex=3;
+// temporalWindowSize =3;
+// templateWindowSize =7;
+// searchWindowSize =21;
+// filterStrength = 75;
+//filterStrengthColor = 50;
+// n = 5;
+// choice = 2;
+// k=multiDenoiseColor(imgToDenoiseIndex,temporalWindowSize,filterStrength,filterStrengthColor,templateWindowSize,searchWindowSize,n,a,b,c,d,e);
+//
+// Authors
+// Shubham Lohakare, NITK Surathkal
+// Ashish Mantosh, NIT Rourkela
+ [lhs, rhs] = argn(0)
+
+ select rhs
+ case 10 then
+ for i = 1:n
+ varargin(i) = mattolist(varargin(i))
+ end
+ out = raw_multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n,varargin(1), varargin(2), varargin(3))
+ case 11 then
+ for i = 1:n
+ varargin(i) = mattolist(varargin(i))
+ end
+ out = raw_multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n, varargin(1), varargin(2), varargin(3), varargin(4))
+ case 12 then
+ for i = 1:n
+ varargin(i) = mattolist(varargin(i))
+ end
+ out = raw_multiDenoiseColor(imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize, n,varargin(1), varargin(2), varargin(3), varargin(4), varargin(5))
+ end
+
+ channel = size(out)
+
+ for i= 1: channel
+ denoise(:,:,i) = (out(i))
+ end
+
+endfunction
diff --git a/sci_gateway/cpp/opencv_adaptHistEq.cpp b/sci_gateway/cpp/opencv_adaptHistEq.cpp
new file mode 100644
index 0000000..e0dbc38
--- /dev/null
+++ b/sci_gateway/cpp/opencv_adaptHistEq.cpp
@@ -0,0 +1,200 @@
+/*************************************************************************************
+Author : Yash S. Bhalgat, Shubham Lohakare
+***************************************************************************************
+---------- Performs Contrast Limited Adaptive Histogram Equalisation -------------
+Usage :
+ 1) output_img = adapthisteq(input_img);
+ In this usage, the image itself is used as the guidance image.
+
+ 2) output_img = adapthisteq(input_img, clip_limit);
+Example :
+ img = imread("lena.jpg");
+ imshow(img);
+ output_img = adapthisteq(img, 9);
+ imshow(output_img);
+***********************************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+#include // std::max
+
+using namespace cv;
+using namespace std;
+
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include
+ #include "../common.h"
+
+
+
+ int opencv_adaptHistEq(char *fname, unsigned long fname_len)
+ {
+
+ //DEclaring variables
+ SciErr sciErr;
+ int intErr = 0;
+ int iRows=0,iCols=0;
+ int *piAddr2 = NULL;
+ int i,j,k;
+ double clip_limit;
+
+ //Default clip limit
+ clip_limit = 0.001;
+
+ //checking input argument
+ CheckInputArgument(pvApiCtx, 1, 2);
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking output argument
+
+ int inputarg = *getNbInputArgument(pvApiCtx);//Storing the number of input arguments
+
+
+ Mat input_img;
+ retrieveImage(input_img,1);//Retrieving the image
+ input_img.convertTo(input_img,CV_8U);//Converting the image to 8-bit image
+
+ if(inputarg == 2){
+ //for value of clip_limit
+ sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr = getScalarDouble(pvApiCtx, piAddr2, &clip_limit);//Getting the value of clip_limit
+ if(intErr)
+ return intErr;
+ }
+
+ float C[256];
+
+ //Getting the number of rows and columns from the image
+ int row = input_img.rows;
+ int col = input_img.cols;
+
+ int window_x = 90;
+ int window_y = 90;
+
+ int min_x, min_y, max_x, max_y;
+ Mat window_matrix;
+
+ int histSize = 256; //from 0 to 255
+ float range[] = { 0, 256 } ;
+ const float* histRange = { range };
+
+ Mat H;
+ Mat output_img = Mat::zeros(input_img.size(), input_img.type());
+
+ if(input_img.channels()==1){
+ for(int i=0; i(i,j)==0)
+ output_img.at(i,j) =0;
+ else
+ {
+ calcHist(&window_matrix, 1, 0, Mat(), H, 1, &histSize, &histRange);//Calculating hist
+
+ int N = window_matrix.rows;
+ int M = window_matrix.cols;
+ H=H/(N*M);
+
+ for(int z=0; z<256; z++){
+ if(H.at(0,z) > clip_limit)
+ H.at(0,z) = clip_limit;
+ }
+
+ float contrastArea = 1.0 - cv::sum(H).val[0];
+ float height = contrastArea / 256.00;
+
+ H = H + height;
+ C[0] = H.at(0,0)*255;
+ for(int k=1; k<256; k++){
+ C[k]= C[k-1] + H.at(0,k)*255;
+ }
+
+ output_img.at(i,j) = C[input_img.at(i,j)];
+ }
+ }
+ }
+ }
+ else if(input_img.channels()==3){
+ vector Ichannels;
+ split(input_img, Ichannels);
+
+ for(int d=0; d<3; d++){
+ for(int i=0; i(i,j)==0)
+ output_img.at(i,j)[d] =0;
+ else
+ {
+ calcHist(&window_matrix, 1, 0, Mat(), H, 1, &histSize, &histRange);
+
+ int N = window_matrix.rows;
+ int M = window_matrix.cols;
+ H=H/(N*M);
+
+ for(int z=0; z<256; z++){
+ if(H.at(0,z) > clip_limit)
+ H.at(0,z) = clip_limit;
+ }
+
+ float contrastArea = 1.0 - cv::sum(H).val[0];
+ float height = contrastArea / 256.00;
+
+ H = H + height;
+ C[0] = H.at(0,0)*255;
+ for(int k=1; k<256; k++){
+ C[k]= C[k-1] + H.at(0,k)*255;
+ }
+
+ output_img.at(i,j)[d] = C[Ichannels[d].at(i,j)];
+ }
+ }
+ }
+ }
+
+
+ }
+
+
+
+ //returning image
+ string tempstring = type2str(output_img.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,output_img,1);
+ free(checker);
+
+ //Assigning the list as the Output Variable
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ //Returning the Output Variables as arguments to the Scilab environment
+ ReturnArguments(pvApiCtx);
+ return 0;
+
+ }
+/* ==================================================================== */
+}
+
diff --git a/sci_gateway/cpp/opencv_boxfilter.cpp b/sci_gateway/cpp/opencv_boxfilter.cpp
new file mode 100644
index 0000000..239ec76
--- /dev/null
+++ b/sci_gateway/cpp/opencv_boxfilter.cpp
@@ -0,0 +1,200 @@
+/* ==================================================================== */
+/* Author :Priyanka Hiranandani NIT Surat, Shubham Lohakare NITK Surathkal */
+/* ==================================================================== */
+/* Syntax : return_image==boxfilter(InputArray src, int ddepth,size.x,size,y,point.x,point.y, bool normalize)*/
+/* ==================================================================== */
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "../common.h"
+ int opencv_boxfilter(char *fname, unsigned long fname_len)
+ {
+ // Error management variable
+ SciErr sciErr;
+
+ //Declaration of variables
+ int iRows = 0;
+ int iCols = 0;
+ int piRows = 0;
+ int piCols = 0;
+ int* piAddr = NULL;
+ int* piAddr2 = NULL;
+ int* piAddr3 = NULL;
+ int* piAddr4 = NULL;
+ int* piAddr5 = NULL;
+ int* piAddr6 = NULL;
+ int* piAddr7 = NULL;
+ int* piAddrNew = NULL;
+ int* piLen = NULL;
+ double* pstData = NULL;
+ char** pstData2 = NULL;
+ double *rrows;
+ double *rcols;
+ int noofitem;
+ double ddepth;
+ bool normalize;
+ int borderType,i;
+ int error;
+ double sz1,sz2;
+ double pi1,pi2;
+
+ // checking input argument
+ CheckInputArgument(pvApiCtx,7,7);
+ //checking output argument
+ CheckOutputArgument(pvApiCtx, 1, 1);
+
+ //for first argument
+ Mat img;
+ retrieveImage(img,1);
+ img.convertTo(img,CV_8U);
+ //second argument
+ sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch value of second argument
+ error=getScalarDouble(pvApiCtx,piAddr2,&ddepth);
+ if(error!=0)
+ {
+ printf("error in retrieving second argument");
+ return 0;
+ }
+ //third argument
+ sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch value of third argument
+ error=getScalarDouble(pvApiCtx,piAddr3,&sz1);
+ if(error!=0)
+ {
+ printf("error in retrieving second argument");
+ return 0;
+ }
+
+ //fourth argument
+ sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch value of fourth argument
+ error=getScalarDouble(pvApiCtx,piAddr4,&sz2);
+ if(error!=0)
+ {
+ printf("error in retrieving second argument");
+ }
+ //fifth argument
+ sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch value of fifth argument
+ error=getScalarDouble(pvApiCtx,piAddr5,&pi1);
+ if(error!=0)
+ {
+ printf("error in retrieving second argument");
+ }
+ //sixth argument
+ sciErr = getVarAddressFromPosition(pvApiCtx,6,&piAddr6);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch value of sixth argument
+ error=getScalarDouble(pvApiCtx,piAddr6,&pi2);
+ if(error!=0)
+ {
+ printf("error in retrieving second argument");
+ }
+ //seventh argument
+ sciErr = getVarAddressFromPosition(pvApiCtx,7,&piAddr7);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch value of seventh argument
+ sciErr = getMatrixOfString(pvApiCtx, piAddr7, &iRows, &iCols, NULL, NULL);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ piLen = (int*)malloc(sizeof(int) * iRows * iCols);
+ //second call to retrieve length of each string
+ sciErr = getMatrixOfString(pvApiCtx, piAddr7, &iRows, &iCols, piLen, NULL);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ pstData2 = (char**)malloc(sizeof(char*) * iRows * iCols);
+ for(i = 0 ; i < iRows * iCols ; i++)
+ {
+ pstData2[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
+ }
+ //third call to retrieve data
+ sciErr = getMatrixOfString(pvApiCtx, piAddr7, &iRows, &iCols, piLen, pstData2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ if(!strcmp(pstData2[0],"True"))
+ {
+ normalize=true;
+ }
+ else if(!strcmp(pstData2[0],"False"))
+ {
+ normalize=true;
+
+ }
+
+ //size constructor
+ Size ksize=Size(sz1,sz2);
+ //anchor constructor
+ Point anchor=Point(pi1,pi2);
+ Mat dst;
+ try{
+ //call to open cv boxfilter
+ boxFilter(img,dst,ddepth,ksize,anchor,normalize,BORDER_DEFAULT);
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ printf("%s",err);
+ }
+
+ //returning variable to scilab console
+ string tempstring = type2str(dst.type());
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ //returning output variable
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+
+
+ }
+}
diff --git a/sci_gateway/cpp/opencv_denoiseColor.cpp b/sci_gateway/cpp/opencv_denoiseColor.cpp
new file mode 100644
index 0000000..2348735
--- /dev/null
+++ b/sci_gateway/cpp/opencv_denoiseColor.cpp
@@ -0,0 +1,140 @@
+/*
+This is the .cpp gateway file for the 'denoiseColor' scilab function.
+
+It includes the following OpenCV functions, belonging to the Photo module of OpenCV 3.0.0 :
+
+void cv::fastNlMeansDenoisingColored (InputArray src, OutputArray dst, float h = 3,float hColor = 3, int templateWindowSize = 7,int searchWindowSize = 21 )
+
+ Removes noise from the input image. Also removes colored noise.
+
+Author : Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh Barik, NIT Rourkela
+*/
+
+#include
+#include"opencv2/core/core.hpp"
+#include"opencv2/highgui/highgui.hpp"
+#include"opencv2/opencv.hpp"
+#include"opencv2/shape/shape_transformer.hpp"
+#include"opencv2/shape.hpp"
+#include"opencv2/imgcodecs.hpp"
+#include"opencv2/imgproc/imgproc.hpp"
+#include"opencv2/features2d/features2d.hpp"
+#include"opencv2/core/utility.hpp"
+#include
+#include
+#include
+
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_denoiseColor(char *fname, unsigned long fname_len)
+ { SciErr sciErr;
+ int i;
+
+ CheckInputArgument(pvApiCtx ,5 ,5 );//Checking number of Input Arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking number of Output Arguments
+
+ Mat src,dst;
+
+ int *piAddr2 = NULL;//Variables for 2nd Input Argument
+ int intErr2 = 0;
+ double filterStrength = 0;
+
+ int *piAddr3 = NULL;//Variables for 3rd Input Argument
+ int intErr3 = 0;
+ double filterStrengthColor=0;
+
+ int *piAddr4 = NULL;//Variables for 4th Input Argument
+ int intErr4 = 0;
+ double templateWindowSize=0;
+
+ int *piAddr5 = NULL;//Variables for 5th Input Argument
+ int intErr5 = 0;
+ double searchWindowSize=0;
+
+
+ // to get the argument #2
+ sciErr = getVarAddressFromPosition( pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &filterStrength);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ // to get the argument #3
+ sciErr = getVarAddressFromPosition( pvApiCtx, 3, &piAddr3);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr3 = getScalarDouble(pvApiCtx, piAddr3, &filterStrengthColor);
+ if(intErr3)
+ {
+ return intErr3;
+ }
+
+ // to get the argument #4
+ sciErr = getVarAddressFromPosition( pvApiCtx, 4, &piAddr4);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr4 = getScalarDouble(pvApiCtx, piAddr4, &templateWindowSize);
+ if(intErr4)
+ {
+ return intErr4;
+ }
+
+ // to get the argument #5
+ sciErr = getVarAddressFromPosition( pvApiCtx, 5, &piAddr5);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr5 = getScalarDouble(pvApiCtx, piAddr5, &searchWindowSize);
+ if(intErr5)
+ {
+ return intErr5;
+ }
+ try{
+
+ retrieveImage(src,1);//Retrieving the input image
+ src.convertTo(src,CV_8U);//Converting to 8 bit image
+ fastNlMeansDenoisingColored(src, dst, filterStrength,filterStrengthColor, templateWindowSize, searchWindowSize);//Calling the denoising OpenCV function
+ }
+ catch(Exception& e)
+ {
+ const char* err = e.what();
+ sciprint("%s", err);
+ }
+
+ string tempstring = type2str(dst.type());//Returning the output to scilab console
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ }
+
+}
diff --git a/sci_gateway/cpp/opencv_fastNlMeansDenoising.cpp b/sci_gateway/cpp/opencv_fastNlMeansDenoising.cpp
new file mode 100644
index 0000000..35c6643
--- /dev/null
+++ b/sci_gateway/cpp/opencv_fastNlMeansDenoising.cpp
@@ -0,0 +1,169 @@
+/*
+This is the .cpp gateway file for the 'fastNlMeansDenoising' scilab function.
+
+It includes the following OpenCV functions, belonging to the Photo module of OpenCV 3.0.0 :
+
+void cv::fastNlMeansDenoising ( InputArray src, OutputArray dst, float h = 3,int templateWindowSize = 7,int searchWindowSize = 21 )
+void cv::fastNlMeansDenoising (InputArray src, OutputArray dst, const std::vector &h, int templateWindowSize=7, int searchWindowSize=21, int normType=NORM_L1)
+void cv::fastNlMeansDenoising (InputArray src, OutputArray dst, const std::vector &h, int templateWindowSize=7, int searchWindowSize=21, int normType=NORM_L2)
+
+ Removes noise from the input image. The noise is expected to be gaussian white noise.
+
+Author : Shubham Lohakare, NITK Surathkal
+ Ashish Manatosh Barik, NIT Rourkela
+*/
+
+
+#include
+#include"opencv2/core/core.hpp"
+#include"opencv2/highgui/highgui.hpp"
+#include"opencv2/opencv.hpp"
+#include"opencv2/shape/shape_transformer.hpp"
+#include"opencv2/shape.hpp"
+#include"opencv2/imgcodecs.hpp"
+#include"opencv2/imgproc/imgproc.hpp"
+#include"opencv2/features2d/features2d.hpp"
+#include"opencv2/core/utility.hpp"
+#include
+#include
+#include
+#include"opencv2/core/cuda.hpp"
+using namespace cv;
+using namespace std;
+using namespace cv::cuda;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_fastNlMeansDenoising(char *fname, unsigned long fname_len)
+ {
+ SciErr sciErr;
+ int i;
+
+ CheckInputArgument(pvApiCtx ,5 ,5 );//Checking number of Input Arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking number of Output Arguments
+
+ int *piAddr2 = NULL;//Variables for 2nd Input Argument
+ int intErr2 = 0;
+ double filterStrength = 0;
+
+ int *piAddr3 = NULL;//Variables for 3rd Input Argument
+ int intErr3 = 0;
+ double templateWindowSize=0;
+
+ int *piAddr4 = NULL;//Variables for 4th Input Argument
+ int intErr4 = 0;
+ double searchWindowSize=0;
+
+ int *piAddr5 = NULL;//Variables for 5th Input Argument
+ int intErr5 = 0;
+ double choice=0;
+
+
+ Mat src,dst;
+ retrieveImage(src,1);//Retrieving the image
+ src.convertTo(src,CV_8U);//Converting the image to 8bit image
+
+ // to get the argument #2
+ sciErr = getVarAddressFromPosition( pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &filterStrength);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ // to get the argument #3
+ sciErr = getVarAddressFromPosition( pvApiCtx, 3, &piAddr3);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr3 = getScalarDouble(pvApiCtx, piAddr3, &templateWindowSize);
+ if(intErr3)
+ {
+ return intErr3;
+ }
+
+ // to get the argument #4
+ sciErr = getVarAddressFromPosition( pvApiCtx, 4, &piAddr4);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr4 = getScalarDouble(pvApiCtx, piAddr4, &searchWindowSize);
+ if(intErr4)
+ {
+ return intErr4;
+ }
+ // to get the argument #5
+ sciErr = getVarAddressFromPosition( pvApiCtx, 5, &piAddr5);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr5 = getScalarDouble(pvApiCtx, piAddr5, &choice);
+ if(intErr5)
+ {
+ return intErr5;
+ }
+
+ //Stream stream = Null();
+
+ try{
+
+ /*if(choice==1)
+ fastNlMeansDenoising(src, dst, filterStrength, searchWindowSize, templateWindowSize, stream );//Calling the denoising OpenCV function*/
+
+ if(choice==1)
+ fastNlMeansDenoising(src, dst, filterStrength, templateWindowSize, searchWindowSize );//Calling the fastNlDenoising OpenCV function
+
+ else if(choice==2)
+ {
+ vector h;
+ h.push_back(filterStrength);
+ fastNlMeansDenoising(src, dst, h, templateWindowSize, searchWindowSize, NORM_L1 );//Calling the fastNlDenoising OpenCV function with NORM_L1
+ }
+
+ else if(choice==3)
+ {
+ vector h;
+ h.push_back(filterStrength);
+ fastNlMeansDenoising(src, dst, h, templateWindowSize, searchWindowSize, NORM_L2 );//Calling the fastNlDenoising OpenCV function with NORM_l2
+ }
+
+ else
+ sciprint("INVALID INPUT for choice. Enter 1\n2\n3\nor 4\n");//If wrong input is given
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+
+
+ string tempstring = type2str(dst.type());//Returning the image to Scilab console
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ }
+
+}
diff --git a/sci_gateway/cpp/opencv_findContours.cpp b/sci_gateway/cpp/opencv_findContours.cpp
new file mode 100644
index 0000000..d7f28f6
--- /dev/null
+++ b/sci_gateway/cpp/opencv_findContours.cpp
@@ -0,0 +1,164 @@
+/********************************************************
+ Author: Abhilasha Sancheti, Sukul Bagai, Shubham Lohakare
+*********************************************************
+ contours = findcontours(input_image(after canny is applied on it), mode, method, point_x, point_y)
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include
+ #include "../common.h"
+
+ int opencv_findContours(char *fname, unsigned long fname_len)
+ {
+ //Declaring variables
+ SciErr sciErr;
+ int intErr=0;
+ int iRows=0,iCols=0;
+ int *piLen2=NULL;
+ int *piLen3 = NULL;
+ int *piAddrNew = NULL;
+ int *piAddr2 = NULL;
+ int *piAddr3 = NULL;
+ int *piAddr4 = NULL;
+ int *piAddr5 = NULL;
+ int i,j,k, findmode , findmethod;
+ double find_method , mode;
+ double x,y;
+
+
+ CheckInputArgument(pvApiCtx, 5, 5);//checking input argument
+ CheckOutputArgument(pvApiCtx, 1, 1) ;//checking output argument
+
+
+ Mat src;
+ retrieveImage(src,1);//Retrieving the input image
+ src.convertTo(src,CV_8U);//Converting the input image to 8-bit image
+ sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr = getScalarDouble(pvApiCtx, piAddr2,&mode);//Getting the second input argument
+ if(intErr)
+ return intErr;
+
+ sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr = getScalarDouble(pvApiCtx, piAddr3,&find_method);//Getting the third input argument
+ if(intErr)
+ return intErr;
+ //toget the x coordinate of point parameter of findcontours
+ sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr = getScalarDouble(pvApiCtx, piAddr4,&x);//Getting the fourth input argument
+ if(intErr)
+ return intErr;
+
+ //toget the y coordinate of point parameter of findcontours
+ sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr = getScalarDouble(pvApiCtx, piAddr5 ,&y);//Getting the fifth input argument
+ if(intErr)
+ return intErr;
+
+ //to set hte mode for findcontour
+ if(mode==1)
+ findmode = CV_RETR_EXTERNAL;
+ else if (mode==2)
+ findmode = CV_RETR_LIST;
+ else if (mode==3)
+ findmode = CV_RETR_CCOMP;
+ else if (mode==4)
+ findmode = CV_RETR_TREE;
+ else
+ {
+ findmode = CV_RETR_LIST;
+ sciprint("wrong mode given , using CV_RETR_TREE instead");
+ }
+ // to set the method for findContours
+ if (find_method==1)
+ findmethod = CV_CHAIN_APPROX_NONE;
+ else if (find_method==2)
+ findmethod = CV_CHAIN_APPROX_SIMPLE;
+ else if (find_method==3)
+ findmethod = CV_CHAIN_APPROX_TC89_L1;
+ else if (find_method==4)
+ findmethod = CV_CHAIN_APPROX_TC89_KCOS;
+ else
+ {
+ findmethod = CV_CHAIN_APPROX_NONE;
+ sciprint("wrong method given , using CV_CHAIN_APPROX_SIMPLE instead");
+ }
+ Point pt(x,y);
+ /// Find contours
+ vector > contours;
+ vector hierarchy;
+ try{
+ findContours( src, contours, findmode, findmethod);
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ printf("%s",err);
+ }
+ //Assigning the list as the Output Variable
+ sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, contours.size(), &piAddrNew);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ for(i=0;i
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/imgproc/imgproc.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include
+ #include "../common.h"
+ int opencv_histeq(char *fname, unsigned long fname_len)
+ {
+
+ // Error management variable
+ SciErr sciErr;
+
+ //checking input argument
+ CheckInputArgument(pvApiCtx,1,1);
+ //checking output argument
+ CheckOutputArgument(pvApiCtx,1,1) ;
+ //for first argument
+ Mat img,p,dst;
+
+ retrieveImage(img,1);//Retrieving the input image
+ try{
+ img.convertTo(img,CV_8U);//Converting the image to 8-bit image
+ cvtColor(img,img,CV_BGR2GRAY);//Converting to grayscale
+
+ //open cv function to equalize the histogram
+ equalizeHist(img,dst);
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ printf("%s",err);
+ }
+
+ string tempstring = type2str(dst.type());
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ }
+}
+/* ==================================================================== */
+
diff --git a/sci_gateway/cpp/opencv_imadd.cpp b/sci_gateway/cpp/opencv_imadd.cpp
new file mode 100644
index 0000000..1e14b59
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imadd.cpp
@@ -0,0 +1,74 @@
+/********************************************************
+Function :imadd
+Syntax :C=imadd(A,B)
+Author : Tess Zacharias, Shubham Lohakare
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+#include "string.h"
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+ int opencv_imadd(char *fname, unsigned long fname_len)
+ {
+ SciErr sciErr;
+ Mat A,B,C;
+ int* piAddr2=NULL;
+ int iType = 0;
+ int iRet = 0;
+ double value= 0;
+
+ CheckInputArgument(pvApiCtx, 2, 2);//checking Input arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking Output arguments
+
+ retrieveImage(A,1);//Retrieving the first argument
+
+ sciErr =getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ sciErr = getVarType(pvApiCtx, piAddr2, &iType);
+ if(iType==sci_list)//Checking the type of 2nd argument
+ {
+ retrieveImage(B,2);
+ Size s1=A.size();
+ Size s2=B.size();
+ if(s1!=s2)
+ {
+ sciprint("\nBoth input should be same size");
+ return 0;
+ }
+ add(A,B,C);
+ }
+ else
+ {
+ if(isDoubleType(pvApiCtx, piAddr2))
+ {
+ if(isScalar(pvApiCtx, piAddr2))
+ {
+ iRet = getScalarDouble(pvApiCtx, piAddr2, &value);
+ }
+ }
+ add(A,value,C);
+ }
+
+ int temp = nbInputArgument(pvApiCtx) + 1;
+ string tempstring = type2str(C.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,C,1);
+ free(checker);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+}
diff --git a/sci_gateway/cpp/opencv_imcomplement.cpp b/sci_gateway/cpp/opencv_imcomplement.cpp
new file mode 100644
index 0000000..7d88e13
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imcomplement.cpp
@@ -0,0 +1,56 @@
+/********************************************************
+Function :imcomplement
+Syntax :B=imcomplement(A)
+Author : Shubham Lohakare, Tess Zacharias
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+#include "string.h"
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+ int opencv_imcomplement(char *fname, unsigned long fname_len)
+ {
+ //DEclaring variables
+ SciErr sciErr;
+ Mat A,B,C;
+ int* piAddr2=NULL;
+ int iType = 0;
+ int iRet = 0;
+ double value= 0;
+
+ CheckInputArgument(pvApiCtx, 1,1);//Check input arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Check output arguments
+
+ retrieveImage(A,1);//Retrieving the first input
+ try{
+ cv::subtract(cv::Scalar::all(255),A,A);//Calculates the complement
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+ int temp = nbInputArgument(pvApiCtx) + 1;
+ string tempstring = type2str(A.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,A,1);
+ free(checker);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+}
diff --git a/sci_gateway/cpp/opencv_imcontour.cpp b/sci_gateway/cpp/opencv_imcontour.cpp
new file mode 100644
index 0000000..69014ae
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imcontour.cpp
@@ -0,0 +1,63 @@
+/********************************************************
+Function :imcontour
+Syntax :B=imcontour(A)
+Authors: Tess Zacharias, Shubham Lohakare
+
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_imcontour(char *fname, unsigned long fname_len)
+ {
+
+ SciErr sciErr;
+ int intErr = 0;
+ Mat gray,image;
+ //checking input argument
+ CheckInputArgument(pvApiCtx, 1, 1);
+ CheckOutputArgument(pvApiCtx, 1, 1) ;
+ retrieveImage(image, 1);
+ image.convertTo(image,CV_8U);
+ cvtColor(image, gray, CV_BGR2GRAY);
+ Canny(gray, gray, 100, 200, 3);
+ /// Find contours
+ vector > contours;
+ vector hierarchy;
+ RNG rng(12345);
+ findContours( gray, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
+ /// Draw contours
+ Mat drawing = Mat::zeros( gray.size(), CV_8UC3 );
+ for( int i = 0; i< contours.size(); i++ )
+ {
+ Scalar color = Scalar(rng.uniform(0,255),rng.uniform(0,255),rng.uniform(0,255));
+ drawContours( drawing, contours, i, color, 1, 8, hierarchy, 0, Point());
+ }
+ bitwise_not(drawing,drawing);
+ string tempstring = type2str(drawing.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,drawing,1);
+ free(checker);
+ //Assigning the list as the Output Variable
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ //Returning the Output Variables as arguments to the Scilab environment
+ ReturnArguments(pvApiCtx);
+ return 0;
+
+ }
+}
diff --git a/sci_gateway/cpp/opencv_imdecolor.cpp b/sci_gateway/cpp/opencv_imdecolor.cpp
new file mode 100644
index 0000000..c8acc3c
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imdecolor.cpp
@@ -0,0 +1,70 @@
+/*
+This is a .cpp gateway file for the 'imdecolor' scilab function.
+It uses the OpenCV function : cv::decolor (InputArray src, OutputArray grayscale, OutputArray color_boost)
+It takes an image as input and gives 2 output images. One is a grayscale image and the other a color boosted image.
+
+Author : Shubham Lohakare, NITK Surathkal
+ Ashish Manatosh Barik, NIT Rourkela
+*/
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_imdecolor(char *fname, unsigned long fname_len)
+ { SciErr sciErr;
+ int i;
+
+
+
+ CheckInputArgument(pvApiCtx, 1, 1);//Check The number of input arguments
+ CheckOutputArgument(pvApiCtx, 2, 2) ;//Check The number of output arguments
+
+ Mat src, dst,colout;//Declaring variables
+
+ try{
+ retrieveImage(src,1);//Getting the input image
+ src.convertTo(src,CV_8U);//Converting the image to 8bit
+
+ decolor(src,dst,colout);//OpenCV function. Gives 2 outputs. In dst a decolored image is stored and in colout a color boosted image is stored.
+ }
+ catch(Exception &e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+
+ string tempstring1 = type2str(dst.type());//For returning the first image as output
+ char* checker1;
+ checker1 = (char *)malloc(tempstring1.size() + 1);
+ memcpy(checker1, tempstring1.c_str(), tempstring1.size() + 1);
+ returnImage(checker1,dst,1);
+ free(checker1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+
+ string tempstring2 = type2str(colout.type());//For returning the second image as output
+ char* checker2;
+ checker2 = (char *)malloc(tempstring2.size() + 1);
+ memcpy(checker2, tempstring2.c_str(), tempstring2.size() + 1);
+ returnImage(checker2,colout,2);
+ free(checker2);
+ AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2;
+
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+
+ }
+
+}
diff --git a/sci_gateway/cpp/opencv_imdivide.cpp b/sci_gateway/cpp/opencv_imdivide.cpp
new file mode 100644
index 0000000..6755322
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imdivide.cpp
@@ -0,0 +1,78 @@
+/********************************************************
+Function :imdivide
+Syntax :C=imdivide(A,B)
+Authors : Tess Zacharias, Shubham Lohakare
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+#include "string.h"
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+ int opencv_imdivide(char *fname, unsigned long fname_len)
+ {
+ //DEclaring the variables
+ SciErr sciErr;
+ Mat A,B,C;
+ int* piAddr2=NULL;
+ int iType = 0;
+ int iRet = 0;
+ double value= 0;
+
+ CheckInputArgument(pvApiCtx, 2, 2);//Checking the input arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking the output arguments
+
+ retrieveImage(A,1);//Getting the first argument
+
+ sciErr =getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ sciErr = getVarType(pvApiCtx, piAddr2, &iType);
+ if(iType==sci_list)//Checking the type of 2nd argument
+ {
+ retrieveImage(B,2);
+ Size s1=A.size();
+ Size s2=B.size();
+
+ try{
+ divide(A,B,C);
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+ }
+ else
+ {
+ if(isDoubleType(pvApiCtx, piAddr2))
+ {
+ if(isScalar(pvApiCtx, piAddr2))
+ {
+ iRet = getScalarDouble(pvApiCtx, piAddr2, &value);
+ }
+ }
+ C=A/value;
+ }
+
+ int temp = nbInputArgument(pvApiCtx) + 1;
+ string tempstring = type2str(C.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,C,1);
+ free(checker);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+}
diff --git a/sci_gateway/cpp/opencv_imfill.cpp b/sci_gateway/cpp/opencv_imfill.cpp
new file mode 100644
index 0000000..6f94e05
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imfill.cpp
@@ -0,0 +1,193 @@
+/********************************************************
+Author: Vinay Bhat
+********************************************************
+Usage: return_image = imfill(image)
+ return_image = imfill(image, 'holes')
+ return_image = imfill(image, points)
+Example:
+ im = imfill(image, [1 1; 10 10; 11 12])
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ void imfill_imreconstruct(Mat, Mat, Mat&);
+
+ int opencv_imfill(char *fname, unsigned long fname_len)
+ {
+
+ SciErr sciErr;
+ int intErr = 0;
+ int *piAddr = NULL;
+ int i, j;
+ double maxVal;
+ int iRet;
+ int iRows, iCols;
+ double *pstData = NULL;
+
+ //checking input argument
+ CheckInputArgument(pvApiCtx, 1, 2);
+ CheckOutputArgument(pvApiCtx, 1, 1);
+
+ // Get the input image from the Scilab environment
+ Mat image, dst;
+ retrieveImage(image, 1);
+ image.convertTo(image,CV_8U);
+ if (nbInputArgument(pvApiCtx) == 2)
+ {
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr);
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ if (image.type() != CV_8UC1)
+ {
+ Mat temp;
+ temp = image.clone();
+ cvtColor(temp, image, CV_BGR2GRAY);
+ }
+
+ if(isStringType(pvApiCtx, piAddr))
+ {
+ char* pstData = NULL;
+
+ iRet = getAllocatedSingleString(pvApiCtx, piAddr, &pstData);
+
+ if(iRet)
+ {
+ freeAllocatedSingleString(pstData);
+ return iRet;
+ }
+
+ if (strcmp(pstData, "holes") == 0)
+ {
+ freeAllocatedSingleString(pstData);
+ // Floodfill from point (0, 0)
+ Mat im_floodfill = image.clone();
+ floodFill(im_floodfill, Point(0,0), Scalar(255));
+
+ // Invert floodfilled image
+ Mat im_floodfill_inv;
+ bitwise_not(im_floodfill, im_floodfill_inv);
+
+ // Combine the two images to get the foreground.
+ Mat dst2 = (image | im_floodfill_inv);
+ erode(dst2, dst, Mat());
+
+ }
+ else
+ {
+ sciprint("Option not identified. Maybe you meant 'holes'.");
+ return 0;
+ }
+ }
+ else
+ {
+
+ // Get the points list in the form of a matrix
+ // No. of columns = 2
+ // No. of rows = No. of points
+ sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pstData);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ if (iCols != 2)
+ {
+ sciprint("Please enter a valid column and row index.");
+ return 0;
+ }
+
+ for (i = 0; i < iRows*iCols; i += iCols)
+ {
+ if (pstData[i] < 0 || pstData[i+1] < 0)
+ {
+ sciprint("Coordinates cannot be negative.\n");
+ return 0;
+ }
+ else
+ floodFill(image, Point(pstData[i], pstData[i+1]), Scalar(255));
+ }
+
+ dst = image.clone();
+ }
+
+ }
+ else
+ {
+ Mat gray_image;
+
+ cvtColor(image, gray_image, CV_BGR2GRAY);
+
+ minMaxLoc(gray_image, NULL, &maxVal, NULL, NULL);
+
+ Mat marker = Mat(gray_image.size(), gray_image.type());
+
+ marker = Scalar::all(maxVal);
+
+ for (i = 0; (i == 0 || i == marker.cols-1); i += (marker.cols - 1))
+ {
+ for (j = 0; j < marker.rows; j++)
+ {
+ marker.at(i,j) = gray_image.at(i,j);
+ }
+ }
+
+ for (i = 1; i < marker.cols-1; i++)
+ {
+ for (j = 0; (j == 0 || j == marker.rows-1); j += (marker.rows - 1))
+ {
+ marker.at(i,j) = gray_image.at(i,j);
+ }
+ }
+
+ imfill_imreconstruct(gray_image, marker, dst);
+ }
+
+
+
+ string tempstring = type2str(dst.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker, dst, 1);
+ free(checker);
+
+ //Assigning the list as the Output Variable
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ //Returning the Output Variables as arguments to the Scilab environment
+ ReturnArguments(pvApiCtx);
+ return 0;
+
+ }
+ void imfill_imreconstruct(Mat g, Mat f, Mat& dest)
+ {
+ Mat m0, m1, m;
+ m1 = f;
+ do {
+ m0 = m1.clone();
+ erode(m0, m, Mat());
+ max(g, m, m1);
+ } while(countNonZero(m1 != m0) != 0);
+ dest = m1.clone();
+ }
+
+/* ==================================================================== */
+}
diff --git a/sci_gateway/cpp/opencv_iminpaint.cpp b/sci_gateway/cpp/opencv_iminpaint.cpp
new file mode 100644
index 0000000..97142bf
--- /dev/null
+++ b/sci_gateway/cpp/opencv_iminpaint.cpp
@@ -0,0 +1,103 @@
+/*
+Author : Shubham Lohakare, NITK Surathkal
+
+*/
+#include
+#include"opencv2/core/core.hpp"
+#include"opencv2/highgui/highgui.hpp"
+#include"opencv2/opencv.hpp"
+#include"opencv2/shape/shape_transformer.hpp"
+#include"opencv2/shape.hpp"
+#include"opencv2/imgcodecs.hpp"
+#include"opencv2/imgproc/imgproc.hpp"
+#include"opencv2/features2d/features2d.hpp"
+#include"opencv2/core/utility.hpp"
+#include
+#include
+#include
+
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_iminpaint(char *fname, unsigned long fname_len)
+ {
+ //Declaring Variables
+ SciErr sciErr;
+
+ Mat img1,img2,outputImage;
+
+ int *piAddr3 = NULL;
+ int intErr3 = 0;
+ double radius = 5;
+
+ int *piAddr4 = NULL;
+ int intErr4 = 0;
+ double methodNum=0;
+ int *addvartwo=NULL;
+
+ CheckInputArgument(pvApiCtx, 4, 4);//Checking the input arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking the output arguments
+
+
+ //Getting argument #3
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr3 = getScalarDouble(pvApiCtx, piAddr3, &radius);
+ if(intErr3)
+ {
+ return intErr3;
+ }
+ //Getting argument #4
+ sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr4 = getScalarDouble(pvApiCtx,piAddr4, &methodNum);
+ if(intErr4)
+ {
+ return intErr4;
+ }
+ try
+ {
+ retrieveImage(img1,1);//Retrieving the source image
+ img1.convertTo(img1,CV_8U);//Converting the image to 8-bit image
+
+
+
+ retrieveImage(img2,2);//Retrieving the mask
+ img2.convertTo(img2,CV_8U);//Converting the mask
+
+ if(methodNum==1)
+ inpaint(img1,img2,outputImage,radius,INPAINT_NS);//Calling the opencv inpaint function with method inpaint_ns
+ else if(methodNum==2)
+ inpaint(img1,img2,outputImage,radius,INPAINT_TELEA);//Calling the opencv inpaint function with method inpaint_telea
+
+ }
+ catch(Exception &e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+ //Assigning the output to be displayed on scilab console
+ string tempstring = type2str(outputImage.type());
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,outputImage,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ }
+}
diff --git a/sci_gateway/cpp/opencv_immultiply.cpp b/sci_gateway/cpp/opencv_immultiply.cpp
new file mode 100644
index 0000000..863a1b7
--- /dev/null
+++ b/sci_gateway/cpp/opencv_immultiply.cpp
@@ -0,0 +1,71 @@
+/********************************************************
+Function :immultiply
+Syntax :C=immultiply(A,B)
+Author : Tess Zacharias, Shubham Lohakare
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+#include "string.h"
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+ int opencv_immultiply(char *fname, unsigned long fname_len)
+ {
+ //Declaring variables
+ SciErr sciErr;
+ Mat A,B,C;
+ int* piAddr2=NULL;
+ int iType = 0;
+ int iRet = 0;
+ double value= 0;
+
+ CheckInputArgument(pvApiCtx, 2, 2);//Checking Input arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking Output arguments
+
+ retrieveImage(A,1);//Retrieving the first input
+
+ sciErr =getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ sciErr = getVarType(pvApiCtx, piAddr2, &iType);
+ if(iType==sci_list)//Checking the type of 2nd argument
+ {
+ retrieveImage(B,2);
+ Size s1=A.size();
+ Size s2=B.size();
+
+ multiply(A,B,C);//Calling the opencv function
+ }
+ else
+ {
+ if(isDoubleType(pvApiCtx, piAddr2))
+ {
+ if(isScalar(pvApiCtx, piAddr2))
+ {
+ iRet = getScalarDouble(pvApiCtx, piAddr2, &value);
+ }
+ }
+ C=A*value;
+ }
+ //Assigning the output to be returned to scilab console
+ int temp = nbInputArgument(pvApiCtx) + 1;
+ string tempstring = type2str(C.type());
+ char *checker;
+ checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,C,1);
+ free(checker);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+ }
+}
diff --git a/sci_gateway/cpp/opencv_imrotate.cpp b/sci_gateway/cpp/opencv_imrotate.cpp
new file mode 100644
index 0000000..d8b0ab2
--- /dev/null
+++ b/sci_gateway/cpp/opencv_imrotate.cpp
@@ -0,0 +1,133 @@
+/* ==================================================================== */
+/* Authors :Priyanka Hiranandani NIT Surat, Shubham Lohakare NITK Surathkal */
+/* ==================================================================== */
+/* Syntax : rotated_image=imrotate(sourcrimage,angle);
+ rotated_image=imrotate(sourceimage,angle,'crop');
+ rotated_image=imrotate(sourceimage,angle,'loose'); */
+/* ==================================================================== */
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+#include
+using namespace cv;
+using namespace std;
+ extern "C"
+ {
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "../common.h"
+ int opencv_imrotate(char *fname, unsigned long fname_len)
+ {
+ // Error management variable
+ SciErr sciErr;
+ //variable info
+ int iRows = 0;
+ int iCols = 0;
+ int piRows = 0;
+ int piCols = 0;
+ int* piAddr = NULL;
+ int* piAddr2 = NULL;
+ int* piAddr3 = NULL;
+ int* piAddrNew = NULL;
+ int* piLen = NULL;
+ double angle;
+ char **pstData2 = NULL;
+ double *rrows;
+ double *rcols;
+ int error;
+ //function to check number of input variable
+ CheckInputArgument(pvApiCtx, 2, 3);
+ //function to check number of output variable
+ CheckOutputArgument(pvApiCtx, 1, 1);
+
+ int n = *getNbInputArgument(pvApiCtx);//Getting the total number of input variables
+
+ // get Address of first input
+ Mat src,dst;
+ retrieveImage(src,1); //Retrieving the first image
+
+ sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2);
+ //checking for error if any
+ if (sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ //this function will fetch second argument i.e angle
+ error=getScalarDouble(pvApiCtx,piAddr2,&angle);
+ if(error!=0)
+ {
+ sciprint("error in retrieving second argument");
+ }
+ if(n==2)//If number of input arguments are 2
+ {
+ cv::Point2f pc(src.cols/2., src.rows/2.);
+ cv::Mat r = cv::getRotationMatrix2D(pc, angle, 1.0);
+
+ cv::warpAffine(src, dst, r, src.size());
+ }
+ if(n==3)//If number of arguments are 3
+ {
+ //Getting the third variable which is the type of bounding box required
+ sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3);
+ sciErr = getMatrixOfString(pvApiCtx, piAddr3, &iRows, &iCols, NULL, NULL);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ piLen = (int*)malloc(sizeof(int) * iRows * iCols);
+ //second call to retrieve length of each string of first argument
+ sciErr = getMatrixOfString(pvApiCtx, piAddr3, &iRows, &iCols, piLen, NULL);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ pstData2 = (char**)malloc(sizeof(char*) * iRows * iCols);
+ for(int i = 0 ; i < iRows * iCols ; i++)
+ {
+ pstData2[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
+ }
+ //third call to retrieve data of each string of first argument
+ sciErr = getMatrixOfString(pvApiCtx, piAddr3, &iRows, &iCols, piLen, pstData2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ if(!strcmp("crop",pstData2[0]))//If type of bounding box is crop
+ {
+ cv::Point2f pc(src.cols/2., src.rows/2.);
+ cv::Mat r = cv::getRotationMatrix2D(pc, angle, 1.0);
+
+ cv::warpAffine(src, dst, r, src.size());
+ }
+ else if(!strcmp("loose",pstData2[0]))//If type of bounding box is loose
+ {
+ cv::Point2f center(src.cols/2.0, src.rows/2.0);
+ cv::Mat rot = cv::getRotationMatrix2D(center, angle, 1.0);
+ // determine bounding rectangle
+ cv::Rect bbox = cv::RotatedRect(center,src.size(), angle).boundingRect();
+ // adjust transformation matrix
+ rot.at(0,2) += bbox.width/2.0 - center.x;
+ rot.at(1,2) += bbox.height/2.0 - center.y;
+
+
+ cv::warpAffine(src, dst, rot, bbox.size());
+ }
+ }
+ //The image which will be shown as output
+ string tempstring = type2str(dst.type());
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ }
+}
diff --git a/sci_gateway/cpp/opencv_ind2gray.cpp b/sci_gateway/cpp/opencv_ind2gray.cpp
new file mode 100644
index 0000000..77a8d35
--- /dev/null
+++ b/sci_gateway/cpp/opencv_ind2gray.cpp
@@ -0,0 +1,151 @@
+/********************************************************
+Author: Vinay,
+ Shubham Lohakare, NITK Surathkal
+
+Function: ind2gray(image, choice)
+image: input image
+choice: choice of the colormap which the user wants to apply
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_ind2gray(char *fname, unsigned long fname_len)
+ {
+
+ SciErr sciErr;
+ int intErr = 0;
+ int iRows=0,iCols=0;
+ int cRows=0,cCols=0;
+ int *piAddr = NULL;
+ int *piAddrNew = NULL;
+
+int *piAddr2 = NULL;//Variables for 2nd Input Argument
+ int intErr2 = 0;
+ double choice = 0;
+ //checking input argument
+ CheckInputArgument(pvApiCtx, 2, 2);
+ CheckOutputArgument(pvApiCtx, 1, 1) ;
+
+ Mat image, imgcpy;
+ retrieveImage(image, 1);
+ image.convertTo(image,CV_8U);
+
+ iRows = image.rows;
+ iCols = image.cols;
+ image.convertTo(imgcpy, CV_64F);
+ //cvtColor(image,image,CV_BGR2GRAY);
+ Mat cmap, cmapcpy;
+ // to get the argument #2
+ sciErr = getVarAddressFromPosition( pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &choice);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ if(choice==0)
+ applyColorMap(image, cmap, COLORMAP_AUTUMN);
+
+ else if(choice==1)
+ applyColorMap(image, cmap, COLORMAP_BONE);
+
+ else if(choice==2)
+ applyColorMap(image, cmap, COLORMAP_JET);
+
+ else if(choice==3)
+ applyColorMap(image, cmap, COLORMAP_WINTER);
+
+ else if(choice==4)
+ applyColorMap(image, cmap, COLORMAP_RAINBOW);
+
+ else if(choice==5)
+ applyColorMap(image, cmap, COLORMAP_OCEAN);
+
+ else if(choice==6)
+ applyColorMap(image, cmap, COLORMAP_SUMMER);
+
+ else if(choice==7)
+ applyColorMap(image, cmap, COLORMAP_SPRING);
+
+ else if(choice==8)
+ applyColorMap(image, cmap, COLORMAP_COOL);
+
+ else if(choice==9)
+ applyColorMap(image, cmap, COLORMAP_HSV);
+
+ else if(choice==10)
+ applyColorMap(image, cmap, COLORMAP_PINK);
+
+ else if(choice==11)
+ applyColorMap(image, cmap, COLORMAP_HOT);
+
+ else if(choice==12)
+ applyColorMap(image, cmap, COLORMAP_PARULA);
+
+ else
+ printf("Wrong input of choice");
+
+
+ cRows = cmap.rows;
+ cCols = cmap.cols;
+ cmap.convertTo(cmapcpy, CV_64F);
+
+ /*for (int i=0; i(i,j)<0 || cmapcpy.at(i,j)>1) {
+ sciprint("Invalid colormap");
+ return 0;
+ }
+ }
+ }*/
+
+ Mat gray = Mat::zeros(image.size(), CV_64F);
+
+
+ for (int i=0; i(i, j);
+ if (temp >= cRows) {
+ temp = cRows - 1;
+ }
+ if (!true) {
+ if (temp!=0) {temp-=1;}
+ }
+ gray.at(i,j) = (0.2989 * cmapcpy.at(temp, 0) + 0.5870 * cmapcpy.at(temp, 1) + 0.1140 * cmapcpy.at(temp, 2)) ;
+
+ }
+ }
+
+ Mat grayimage;
+ gray.convertTo(grayimage, CV_64F);
+ string tempstring = type2str(grayimage.type());//Returning the image to Scilab console
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,grayimage,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+ return 0;
+
+ }
+/* ==================================================================== */
+}
diff --git a/sci_gateway/cpp/opencv_ind2rgb.cpp b/sci_gateway/cpp/opencv_ind2rgb.cpp
new file mode 100644
index 0000000..c7ff043
--- /dev/null
+++ b/sci_gateway/cpp/opencv_ind2rgb.cpp
@@ -0,0 +1,182 @@
+/********************************************************
+Author: Vinay
+
+Function: ind2rgb(image, colormap)
+********************************************************/
+
+#include
+#include "opencv2/core/core.hpp"
+#include "opencv2/highgui/highgui.hpp"
+#include "opencv2/opencv.hpp"
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_ind2rgb(char *fname, unsigned long fname_len)
+ {
+
+ SciErr sciErr;
+ int intErr = 0;
+ int iRows=0,iCols=0;
+ int cRows=0,cCols=0;
+ int *piAddr = NULL;
+ int *piAddrNew = NULL;
+
+
+ int *piAddr2 = NULL;//Variables for 2nd Input Argument
+ int intErr2 = 0;
+ double choice = 0;
+ //unsigned short int *image = NULL;
+ double *map = NULL;
+ int i,j,k;
+ double x, y, width, height;
+
+ //checking input argument
+ CheckInputArgument(pvApiCtx, 2, 2);
+ CheckOutputArgument(pvApiCtx, 1, 1) ;
+
+ Mat image, imgcpy;
+ retrieveImage(image, 1);
+
+ iRows = image.rows;
+ iCols = image.cols;
+ image.convertTo(imgcpy, CV_64F);
+
+ Mat cmap, cmapcpy;
+ sciErr = getVarAddressFromPosition( pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &choice);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ if(choice==0)
+ applyColorMap(image, cmap, COLORMAP_AUTUMN);
+
+ else if(choice==1)
+ applyColorMap(image, cmap, COLORMAP_BONE);
+
+ else if(choice==2)
+ applyColorMap(image, cmap, COLORMAP_JET);
+
+ else if(choice==3)
+ applyColorMap(image, cmap, COLORMAP_WINTER);
+
+ else if(choice==4)
+ applyColorMap(image, cmap, COLORMAP_RAINBOW);
+
+ else if(choice==5)
+ applyColorMap(image, cmap, COLORMAP_OCEAN);
+
+ else if(choice==6)
+ applyColorMap(image, cmap, COLORMAP_SUMMER);
+
+ else if(choice==7)
+ applyColorMap(image, cmap, COLORMAP_SPRING);
+
+ else if(choice==8)
+ applyColorMap(image, cmap, COLORMAP_COOL);
+
+ else if(choice==9)
+ applyColorMap(image, cmap, COLORMAP_HSV);
+
+ else if(choice==10)
+ applyColorMap(image, cmap, COLORMAP_PINK);
+
+ else if(choice==11)
+ applyColorMap(image, cmap, COLORMAP_HOT);
+
+ else if(choice==12)
+ applyColorMap(image, cmap, COLORMAP_PARULA);
+
+ else
+ printf("Wrong input of choice");
+
+ cRows = cmap.rows;
+ cCols = cmap.cols;
+ cmap.convertTo(cmapcpy, CV_64F);
+
+
+
+
+ double *r,*g,*b;
+ r=(double *)malloc(sizeof(double)*iRows*iCols);
+ g=(double *)malloc(sizeof(double)*iRows*iCols);
+ b=(double *)malloc(sizeof(double)*iRows*iCols);
+ int m = 0;
+
+
+ for (int i=0; i(i, j);
+ if (temp >= cRows) {
+ temp = cRows - 1;
+ }
+ if (!true) {
+ if (temp!=0) {temp-=1;}
+ }
+ r[i + iRows*j] = cmapcpy.at(temp, 0);
+ g[i + iRows*j] = cmapcpy.at(temp, 1);
+ b[i + iRows*j] = cmapcpy.at(temp, 2);
+ }
+ }
+
+ sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, &piAddrNew);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+
+ //Adding the R value matrix to the list
+ //Syntax : createMatrixOfInteger32InList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const int* _piData)
+ sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1 , piAddrNew, 1,iRows, iCols, r);
+ free(r);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ //Adding the G value matrix to the list
+ sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1 , piAddrNew, 2,iCols, iRows, g);
+ free(g);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+ //Adding the B value matrix to the list
+ sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1 , piAddrNew, 3, iCols, iRows, b);
+ free(b);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+
+
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ //Returning the Output Variables as arguments to the Scilab environment
+ ReturnArguments(pvApiCtx);
+ return 0;
+
+ }
+/* ==================================================================== */
+}
diff --git a/sci_gateway/cpp/opencv_inpaintmask.cpp b/sci_gateway/cpp/opencv_inpaintmask.cpp
new file mode 100644
index 0000000..b347bd1
--- /dev/null
+++ b/sci_gateway/cpp/opencv_inpaintmask.cpp
@@ -0,0 +1,138 @@
+/*
+This is the .cpp gateway file for the 'iminpaint' scilab function.
+It includes the OpenCV function void cv::inpaint ( InputArray src,InputArray inpaintMask,OutputArray dst,double inpaintRadius,int flags)
+The function reconstructs the selected image area from the pixel near the area boundary. The function may be used to remove dust and scratches from a scanned photo, or to remove undesirable objects from still images.
+
+Author: Shubham Lohakare, NITK Surathkal
+ Ashish Manatosh Barik, NIT Rourkela
+*/
+#include
+#include"opencv2/core/core.hpp"
+#include"opencv2/highgui/highgui.hpp"
+#include"opencv2/opencv.hpp"
+#include"opencv2/shape/shape_transformer.hpp"
+#include"opencv2/shape.hpp"
+#include"opencv2/imgcodecs.hpp"
+#include"opencv2/imgproc/imgproc.hpp"
+#include"opencv2/features2d/features2d.hpp"
+#include"opencv2/core/utility.hpp"
+#include
+#include
+#include
+
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_inpaintmask(char *fname, unsigned long fname_len)
+ {
+ SciErr sciErr;
+ int i;
+
+ Mat img1,img;
+ Mat inpainted;
+ /*int *piAddr2 = NULL;//Variables for 3rd argument
+ int intErr2 = 0;
+ double radius = 5;
+
+ int *piAddr3 = NULL;//Variables for 4th argument
+ int intErr3 = 0;
+ double methodNum=0;
+ */
+ CheckInputArgument(pvApiCtx, 1, 1);//Checking the number of input arguments
+ CheckOutputArgument(pvApiCtx, 1, 1);//Checking the number of output arguments
+
+ //To get the argument #2
+ /*sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &radius);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ //To get the argument #3
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr3 = getScalarDouble(pvApiCtx,piAddr3, &methodNum);
+ if(intErr3)
+ {
+ return intErr3;
+ }
+ */
+ try
+ {
+ retrieveImage(img1,1);//Retrieving the input image
+ img1.convertTo(img1,CV_8U);//Converting the image to 8Bit
+
+ cvtColor(img1,img,CV_BGR2GRAY);
+ threshold(img,img,30,255,THRESH_BINARY_INV);
+ //retrieveImage(img2,2);//Retrieving the mask for the image
+ //img2.convertTo(img2,CV_8U);//Converting the mask to 8Bit
+ //cvtColor(img2,img,CV_BGR2GRAY);//Converting the mask to a grayscale image
+
+ int largest_area=0;
+ int largest_contour_index=0;
+ Rect bounding_rect;
+ vector > contours; // Vector for storing contour
+ vector hierarchy;
+ findContours( img, contours, hierarchy,CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE );
+ // iterate through each contour.
+ for( int i = 0; i< contours.size(); i++ )
+ {
+
+ // Find the area of contour
+ double a=contourArea( contours[i],false);
+ if(a>largest_area){
+ largest_area=a;//cout << i<<" area "<
-#include "opencv2/core/core.hpp"
-#include "opencv2/highgui/highgui.hpp"
-#include "opencv2/opencv.hpp"
-#include
-using namespace cv;
-using namespace std;
-extern "C" {
-#include "api_scilab.h"
-#include "Scierror.h"
-#include "BOOL.h"
-#include
-#include "sciprint.h"
-#include "../common.h"
-
-int opencv_integralImage(char *fname, unsigned long fname_len) {
- SciErr sciErr;
- int intErr = 0;
-
-
- int *piAddr1 = NULL;
-
- int error;
-
-// String holding the second argument
- int iRet = 0;
- char* pstData = NULL;
-
-// Checking input argument
- CheckInputArgument(pvApiCtx, 1, 2);
- CheckOutputArgument(pvApiCtx, 1, 1);
-
-// Get input image
-
- Mat image;
- retrieveImage(image, 1);
-
-
-
- for (int i = 0; i < image.rows; i++) {
- for (int j = 0; j < image.cols; j++) {
- sciprint("%f ", image.at(i,j));
-
- }
-
- sciprint("\n");
- }
-
-// Error Checks
-
- if (image.channels() > 1) {
- sciprint("The image must be grayscale.");
- return 0;
- }
-
-// Output variables holding integralImage, squared integralImage, integralImage over rectangle rotated by 45 degrees
- Mat new_image, integralimage, squaredimage, rotatedimage;
-
- integral(image, integralimage, squaredimage, rotatedimage, -1);
-
-// Get the number of input arguments
- int inputarg = *getNbInputArgument(pvApiCtx);
-
- if (inputarg == 1)
- integralimage.copyTo(new_image);
-
- if (inputarg == 2)
-
- {
- sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr1);
-
- if (sciErr.iErr) {
- printError(&sciErr, 0);
- return 0;
- }
-
- if (isStringType(pvApiCtx, piAddr1)) {
- if (isScalar(pvApiCtx, piAddr1)) {
-
- iRet = getAllocatedSingleString(pvApiCtx, piAddr1, &pstData);
- }
- }
- if (strcmp(pstData, "rotated") == 0) {
- rotatedimage.copyTo(new_image);
- } else if (strcmp(pstData, "upright") == 0) {
- integralimage.copyTo(new_image);
- } else {
- sciprint("Unknown Parameter Name:%s\n", pstData);
-
- }
-
- }
-
- // sciprint("\n");
-
- // for (int i = 0; i < new_image.rows; i++) {
- // for (int j = 0; j < new_image.cols; j++) {
- // sciprint("%f ", new_image.at(i,j));
-
- // }
-
- // sciprint("\n");
- // }
-
- // new_image is sent to scilab as output
-
- int temp = nbInputArgument(pvApiCtx) + 1;
- string tempstring = type2str(new_image.type());
- char *checker;
- checker = (char *) malloc(tempstring.size() + 1);
- memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
- returnImage(checker, new_image, 1);
- free(checker);
-
- //Assigning the list as the Output Variable
- AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
- //Returning the Output Variables as arguments to the Scilab environment
- ReturnArguments (pvApiCtx);
- return 0;
-
-}
-/* ==================================================================== */
-}
-
diff --git a/sci_gateway/cpp/opencv_multiDenoise.cpp b/sci_gateway/cpp/opencv_multiDenoise.cpp
new file mode 100644
index 0000000..61af23a
--- /dev/null
+++ b/sci_gateway/cpp/opencv_multiDenoise.cpp
@@ -0,0 +1,365 @@
+/*
+This is the .cpp file for the 'multiDenoise' scilab function.
+It includes the OpenCV function fastNlMeansDenoisingMulti()
+It is used for denoising an image using multiple copies of the image captured in a very minute time interval.
+Author : Shubham Lohakare, NITK Surathkal
+ Ashish Mantosh Barik, NIT Rourkela
+*/
+#include
+#include"opencv2/core/core.hpp"
+#include"opencv2/highgui/highgui.hpp"
+#include"opencv2/opencv.hpp"
+#include"opencv2/shape/shape_transformer.hpp"
+#include"opencv2/shape.hpp"
+#include"opencv2/imgcodecs.hpp"
+#include"opencv2/imgproc/imgproc.hpp"
+#include"opencv2/features2d/features2d.hpp"
+
+#include"opencv2/core/utility.hpp"
+#include
+#include
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_multiDenoise(char *fname, unsigned long fname_len)
+ { SciErr sciErr;
+ int i;
+
+ // Checking number of input and output arguments (enviromnet variable, min arguments, max arguments)
+ CheckInputArgument(pvApiCtx, 10, 12);
+ CheckOutputArgument(pvApiCtx, 1, 1);
+
+ // variables required to read argument #1
+ int *piAddr1 = NULL;
+ int intErr1 = 0;
+ double imgToDenoiseIndex = 0;
+
+ // variables required to read argument #2
+ int *piAddr2 = NULL;
+ int intErr2 = 0;
+ double temporalWindowSize = 0;
+
+ // variables required to read argument #3
+ int *piAddr3 = NULL;
+ int intErr3 = 0;
+ double filterStrength = 0;
+
+ // variables required to read argument #4
+ int *piAddr4 = NULL;
+ int intErr4 = 0;
+ double templateWindowSize = 0;
+
+ // variables required to read argument #5
+ int *piAddr5 = NULL;
+ int intErr5 = 0;
+ double searchWindowSize = 0;
+
+ // variables required to read argument #6
+ int *piAddr6 = NULL;
+ int intErr6 = 0;
+ double n = 0;
+
+ // variables required to read argument #7
+ int *piAddr7 = NULL;
+ int intErr7 = 0;
+ double choice = 0;
+
+
+
+ cv::Mat img1,img2,img3,dst;
+
+ // to get argument #1
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr1 = getScalarDouble(pvApiCtx, piAddr1, &imgToDenoiseIndex);
+ if(intErr1)
+ {
+ return intErr1;
+ }
+
+ // to get argument #2
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &temporalWindowSize);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ // to get argument #3
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr3 = getScalarDouble(pvApiCtx, piAddr3, &filterStrength);
+ if(intErr3)
+ {
+ return intErr3;
+ }
+ // to get argument #4
+ sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr4 = getScalarDouble(pvApiCtx, piAddr4, &templateWindowSize);
+ if(intErr4)
+ {
+ return intErr4;
+ }
+ // to get argument #5
+ sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr5);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr5 = getScalarDouble(pvApiCtx, piAddr5, &searchWindowSize);
+ if(intErr5)
+ {
+ return intErr5;
+ }
+
+ // to get argument #6
+ sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddr6);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr6 = getScalarDouble(pvApiCtx, piAddr6, &n);
+ if(intErr6)
+ {
+ return intErr6;
+ }
+
+ // to get argument #7
+ sciErr = getVarAddressFromPosition(pvApiCtx, 7, &piAddr7);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr7 = getScalarDouble(pvApiCtx, piAddr7, &choice);
+ if(intErr7)
+ {
+ return intErr7;
+ }
+
+ Mat img4, img5;
+
+ try{
+ vector images;
+ retrieveImage(img1, 8);//Retrieving image#1
+ retrieveImage(img2, 9);//Retrieving image#2
+ retrieveImage(img3, 10);//Retrieving image#3
+
+ img1.convertTo(img1,CV_8U);
+
+ img2.convertTo(img2,CV_8U);
+
+ img3.convertTo(img3,CV_8U);
+
+ if(choice==1){
+
+ if(n == 3)
+ {
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize);
+ }
+ else if(n == 4)
+ {
+
+ retrieveImage(img4, 11);//Retrieving image#4
+
+ img4.convertTo(img4,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize);
+ }
+ else if(n == 5)
+ {
+
+ retrieveImage(img4, 11);//Retrieving image#4
+ retrieveImage(img5, 12);//Retrieving image#5
+
+ img4.convertTo(img4,CV_8U);
+ img5.convertTo(img5,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+ images.push_back(img5);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, filterStrength, templateWindowSize, searchWindowSize);
+ }
+ else
+ {
+ Scierror(999, "Wrong input for 'number of images'.", 1);
+ }
+
+ }
+ else if(choice==2)
+ {
+
+ if(n == 3)
+ { vector h;
+ h.push_back(filterStrength);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+
+ sciprint("yo");
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize,NORM_L1);
+ }
+ else if(n == 4)
+ {
+ vector h;
+ h.push_back(filterStrength);
+
+
+ retrieveImage(img4, 11);//Retrieving image#4
+
+ img4.convertTo(img4,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize,NORM_L1);
+ }
+ else if(n == 5)
+ {
+ vector h;
+ h.push_back(filterStrength);
+
+
+ retrieveImage(img4, 11);//Retrieving image#4
+ retrieveImage(img5, 12);//Retrieving image#5
+
+ img4.convertTo(img4,CV_8U);
+ img5.convertTo(img5,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+ images.push_back(img5);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize,NORM_L1);
+ }
+ else
+ {
+ Scierror(999, "Wrong input for 'number of images'.", 1);
+ }
+
+ }
+
+ else if(choice==3)
+ { vector h;
+ h.push_back(filterStrength);
+ if(n == 3)
+ {
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+
+ sciprint("yo");
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize,NORM_L2);
+ }
+ else if(n == 4)
+ {
+ vector h;
+ h.push_back(filterStrength);
+
+
+ retrieveImage(img4, 11);//Retrieving image#4
+
+ img4.convertTo(img4,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize,NORM_L2);
+ }
+ else if(n == 5)
+ {
+ vector h;
+ h.push_back(filterStrength);
+
+
+ retrieveImage(img4, 11);//Retrieving image#4
+ retrieveImage(img5, 12);//Retrieving image#5
+
+ img4.convertTo(img4,CV_8U);
+ img5.convertTo(img5,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+ images.push_back(img5);
+
+ fastNlMeansDenoisingMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, h, templateWindowSize, searchWindowSize,NORM_L2);
+ }
+ else
+ {
+ Scierror(999, "Wrong input for 'number of images'.", 1);
+ }
+
+ }
+
+
+
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+
+ string tempstring = type2str(dst.type());//Returning the image to scilab console
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+
+ }
+}
diff --git a/sci_gateway/cpp/opencv_multiDenoiseColor.cpp b/sci_gateway/cpp/opencv_multiDenoiseColor.cpp
new file mode 100644
index 0000000..d9a2d4c
--- /dev/null
+++ b/sci_gateway/cpp/opencv_multiDenoiseColor.cpp
@@ -0,0 +1,250 @@
+/*
+This is the .cpp file for the 'multiDenoiseColor' scilab function.
+It includes the OpenCV function fastNlMeansDenoisingColoredMulti()
+It is used for removing colored noise from an image using multiple copies of the image captured in a very minute time interval.
+Author : Shubham Lohakare, NITK Surathkal
+ Ashish Manatosh Barik, NIT Rourkela
+*/
+#include
+#include"opencv2/core/core.hpp"
+#include"opencv2/highgui/highgui.hpp"
+#include"opencv2/opencv.hpp"
+#include"opencv2/shape/shape_transformer.hpp"
+#include"opencv2/shape.hpp"
+#include"opencv2/imgcodecs.hpp"
+#include"opencv2/imgproc/imgproc.hpp"
+#include"opencv2/features2d/features2d.hpp"
+
+#include"opencv2/core/utility.hpp"
+#include
+#include
+#include
+using namespace cv;
+using namespace std;
+extern "C"
+{
+ #include "api_scilab.h"
+ #include "Scierror.h"
+ #include "BOOL.h"
+ #include
+ #include "sciprint.h"
+ #include "../common.h"
+
+ int opencv_multiDenoiseColor(char *fname, unsigned long fname_len)
+ { SciErr sciErr;
+ int i;
+
+ // Checking number of input and output arguments (enviromnet variable, min arguments, max arguments)
+ CheckInputArgument(pvApiCtx, 10, 12);
+ CheckOutputArgument(pvApiCtx, 1, 1);
+
+ // variables required to read argument #1
+ int *piAddr1 = NULL;
+ int intErr1 = 0;
+ double imgToDenoiseIndex = 0;
+
+ // variables required to read argument #2
+ int *piAddr2 = NULL;
+ int intErr2 = 0;
+ double temporalWindowSize = 0;
+
+ // variables required to read argument #3
+ int *piAddr3 = NULL;
+ int intErr3 = 0;
+ double filterStrength = 0;
+
+ // variables required to read argument #4
+ int *piAddr4 = NULL;
+ int intErr4 = 0;
+ double filterStrengthColor = 0;
+
+ // variables required to read argument #5
+ int *piAddr5 = NULL;
+ int intErr5 = 0;
+ double templateWindowSize = 0;
+
+ // variables required to read argument #6
+ int *piAddr6 = NULL;
+ int intErr6 = 0;
+ double searchWindowSize = 0;
+
+ // variables required to read argument #7
+ int *piAddr7 = NULL;
+ int intErr7 = 0;
+ double n = 0;
+
+
+ cv::Mat img1,img2,img3,dst;
+
+ // to get argument #1
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr1 = getScalarDouble(pvApiCtx, piAddr1, &imgToDenoiseIndex);
+ if(intErr1)
+ {
+ return intErr1;
+ }
+
+ // to get argument #2
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr2 = getScalarDouble(pvApiCtx, piAddr2, &temporalWindowSize);
+ if(intErr2)
+ {
+ return intErr2;
+ }
+
+ // to get argument #3
+ sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr3 = getScalarDouble(pvApiCtx, piAddr3, &filterStrength);
+ if(intErr3)
+ {
+ return intErr3;
+ }
+ // to get argument #4
+ sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr4 = getScalarDouble(pvApiCtx, piAddr4, &filterStrengthColor);
+ if(intErr4)
+ {
+ return intErr4;
+ }
+ // to get argument #5
+ sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr5);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr5 = getScalarDouble(pvApiCtx, piAddr5, &templateWindowSize);
+ if(intErr5)
+ {
+ return intErr5;
+ }
+
+ // to get argument #6
+ sciErr = getVarAddressFromPosition(pvApiCtx, 6, &piAddr6);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr6 = getScalarDouble(pvApiCtx, piAddr6, &searchWindowSize);
+ if(intErr6)
+ {
+ return intErr6;
+ }
+
+ // to get argument #7
+ sciErr = getVarAddressFromPosition(pvApiCtx, 7, &piAddr7);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ return 0;
+ }
+ intErr7 = getScalarDouble(pvApiCtx, piAddr7, &n);
+ if(intErr7)
+ {
+ return intErr7;
+ }
+
+ try{
+ vector images;
+ retrieveImage(img1, 8);
+ retrieveImage(img2, 9);
+ retrieveImage(img3, 10);
+
+ img1.convertTo(img1,CV_8U);
+
+
+ img2.convertTo(img2,CV_8U);
+
+
+ img3.convertTo(img3,CV_8U);
+
+ Mat img4,img5;
+ //denoise_TVL1(src,dst,1,30);
+ if(n == 3)
+ {
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+
+ sciprint("yo");
+ fastNlMeansDenoisingColoredMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor,templateWindowSize, searchWindowSize);
+ }
+ else if(n == 4)
+ {
+
+ retrieveImage(img4, 10);
+
+ img4.convertTo(img4,CV_8U);
+
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+
+ fastNlMeansDenoisingColoredMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor,templateWindowSize, searchWindowSize);
+ }
+ else if(n == 5)
+ {
+
+ retrieveImage(img4, 10);
+ retrieveImage(img5, 11);
+
+ img4.convertTo(img4,CV_8U);
+ img5.convertTo(img5,CV_8U);
+
+ images.push_back(img1);
+ images.push_back(img2);
+ images.push_back(img3);
+ images.push_back(img4);
+ images.push_back(img5);
+
+ fastNlMeansDenoisingColoredMulti(images, dst, imgToDenoiseIndex, temporalWindowSize, filterStrength, filterStrengthColor, templateWindowSize, searchWindowSize);
+ }
+ else
+ {
+ Scierror(999, "Wrong input for 'number of images'.", 1);
+ }
+
+
+
+ }
+ catch(Exception& e)
+ {
+ const char* err=e.what();
+ sciprint("%s",err);
+ }
+
+ string tempstring = type2str(dst.type());
+ char* checker = (char *)malloc(tempstring.size() + 1);
+ memcpy(checker, tempstring.c_str(), tempstring.size() + 1);
+ returnImage(checker,dst,1);
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ ReturnArguments(pvApiCtx);
+
+ return 0;
+
+ }
+}