Skip to content

Commit d6d4b95

Browse files
committed
added cpp file to Read Image
1 parent bc48a2b commit d6d4b95

File tree

4 files changed

+11984
-0
lines changed

4 files changed

+11984
-0
lines changed

read_img.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
#define STB_IMAGE_IMPLEMENTATION
4+
#include "stb_image.h"
5+
6+
int main()
7+
{
8+
int width, height, bpp;
9+
10+
uint8_t* rgb_image = stbi_load("/home/sundesh/Downloads/colombia.jpg", &width, &height, &bpp, 3);
11+
cout<<width<<" "<<height<<" "<<bpp<<"\n";
12+
int a[256][256][3];
13+
int cnt = 0;
14+
for (int i=0;i<256;++i)
15+
{
16+
for (int j=0;j<256;++j)
17+
{
18+
for (int k=0;k<3;++k)
19+
{
20+
a[i][j][k] = rgb_image[cnt];
21+
// cout<<a[i][j][k]<<" ";
22+
++cnt;
23+
}
24+
// cout<<"\n";
25+
}
26+
// cout<<"\n";
27+
}
28+
stbi_image_free(rgb_image);
29+
30+
return 0;
31+
}

0 commit comments

Comments
 (0)