Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e16b450

Browse files
Decryption for second phase is done
1 parent 881dd47 commit e16b450

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

‎decryption.cpp‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include <stdio.h>
2+
#include <opencv2/opencv.hpp>
3+
4+
using namespace cv;
5+
using namespace std;
6+
7+
const int MAX=1e4+79;
8+
9+
int main()
10+
{
11+
Mat image;
12+
double x[102];
13+
double u; //u is the control parameter for chaotic map,also known as population rate
14+
15+
image = imread( "encryptedImage.jpg", 1 );
16+
if ( !image.data )
17+
{
18+
printf("No image data \n");
19+
return -1;
20+
}
21+
//Applying Logistic map
22+
u=3.94; //It is the condition for logistic map
23+
x[0]=0.4; //Base condition for logistic map
24+
for (int i = 1; i <= 100; ++i)
25+
x[i]=u*x[i-1]*(1-x[i-1]);
26+
sort(x,x+100);
27+
28+
// reading image pixel
29+
int i=1;
30+
31+
for(int r = 0; r < image.rows; ++r) {
32+
for(int c = 0; c < image.cols; ++c) {
33+
if(i>100)
34+
i=1;
35+
int l=x[i]*MAX;
36+
// cout << "Pixel at position (x, y) : (" << c << ", " << r << ") =";
37+
image.at<Vec3b>(r,c)[0]=image.at<Vec3b>(r,c)[0]^l;
38+
image.at<Vec3b>(r,c)[1]=image.at<Vec3b>(r,c)[1]^l;
39+
image.at<Vec3b>(r,c)[2]=image.at<Vec3b>(r,c)[2]^l;
40+
i++;
41+
}
42+
}
43+
namedWindow("Shubham@shaurya", WINDOW_AUTOSIZE );
44+
imshow("Shubham@shaurya", image);
45+
waitKey(0);
46+
47+
return 0;
48+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /