IMAGE CLAHE SK ALGORITHM MATLAB CODE:
%% ENHANCEMENT PROCESS
%--------------APPLYING CLAHE ALGORITHM------------------------------------
INT_THRSH=0.5; %-----------------------------------------------------------% INTENSITY THRESHOLD VALUE
LOW_LMT=0.008; %-----------------------------------------------------------% PIXEL INTENSITY LOWER LIMIT LEVEL
UP_LMT=0.992; %------------------------------------------------------------% HIGH THRESHOLD VALUE
IMG=FILTR_IM;
[m1 n1]=size(FILTR_IM);
AD=double(FILTR_IM)./255;
MEAN_AD=INT_THRSH-mean(mean(AD));
AD=AD+MEAN_AD*(1-AD);
IMG=AD.*255;
k=1;
ARRY=sort(reshape(IMG,m1*n1,1));
MIN_VAL(1)=ARRY(ceil(LOW_LMT*m1*n1));
MAX_VAL(1)=ARRY(ceil(UP_LMT*m1*n1));
IMG=(IMG-MIN_VAL(1))/(MAX_VAL(1)-MIN_VAL(1));
RECON_IMG=uint8(IMG.*255);
subplot(523);
imshow(RECON_IMG);
title('ENHANCED IMAGE');
C++ Code For Image read
%% ENHANCEMENT PROCESS
%--------------APPLYING CLAHE ALGORITHM------------------------------------
INT_THRSH=0.5; %-----------------------------------------------------------% INTENSITY THRESHOLD VALUE
LOW_LMT=0.008; %-----------------------------------------------------------% PIXEL INTENSITY LOWER LIMIT LEVEL
UP_LMT=0.992; %------------------------------------------------------------% HIGH THRESHOLD VALUE
IMG=FILTR_IM;
[m1 n1]=size(FILTR_IM);
AD=double(FILTR_IM)./255;
MEAN_AD=INT_THRSH-mean(mean(AD));
AD=AD+MEAN_AD*(1-AD);
IMG=AD.*255;
k=1;
ARRY=sort(reshape(IMG,m1*n1,1));
MIN_VAL(1)=ARRY(ceil(LOW_LMT*m1*n1));
MAX_VAL(1)=ARRY(ceil(UP_LMT*m1*n1));
IMG=(IMG-MIN_VAL(1))/(MAX_VAL(1)-MIN_VAL(1));
RECON_IMG=uint8(IMG.*255);
subplot(523);
imshow(RECON_IMG);
title('ENHANCED IMAGE');
C++ Code For Image read
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgcodecs.hpp>
#include<opencv2/highgui.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat img;
Mat gry;
img=cv::imread("test.jpg",CV_LOAD_IMAGE_COLOR);
cv::imshow("image",img);
char k;
k=cv::waitKey(0);
if(k=='s')
cv::destroyAllWindows();
return 0;
}
Output:
sk_baby input image MATLAB code for sk baby read and RGB2GRAY conversion Code |
clc
clear all;
close all;
a=imread('sk.jpg');
imshow(a)
c=rgb2gray(a);
imshow(c)
title('gray image');
sk_baby_bw=im2bw(c,0.54);
figure,imshow(sk_baby_bw);
title('sk_baby_binary_image');
figure,imshow(sk_baby_bw);
title('sk_baby_binary_image');
Sk_baby_Gray Image;
Sk_baby_Binary Image;
FACE EYE MOUTH DETECTION