1

I want to read grayscale jpg image stored using opencv. OpenCV code is

im = cv2.imread("cat.jpg", cv2.CV_8UC1)  
im = cv2.resize(im, (224, 224))  
cv2.imwrite("cat_8uc1.jpg", im)    

I want to read this image as below

uint8_t image[294][294] = { all image data }  

Do I need to convert this .jpg image into another format and use?

I want to read this image into 2D array/matrix in C not using any library.

Any Leads will be very helpful.

Miki
  • 40,887
  • 13
  • 123
  • 202
  • Does this answer your question? [C Image Library](https://stackoverflow.com/questions/50079/c-image-library) – Miki Nov 15 '19 at 10:30
  • hint: use a library – Miki Nov 15 '19 at 10:30
  • You need to do everything the library does for you. Read the file, decompress jpg into your array, resize, compress to jpg again, write file. Or you could use a library – Gerhardh Nov 15 '19 at 11:23
  • I cannot use any library. I have to read file and play with it. I have tried reading file into binary file file but I could not decompose it into array. Any leads on how I can decompose this file into array? – Abhijeet Bhilare Nov 16 '19 at 12:17

1 Answers1

0

I solved it by using PGMA image format. Thank you for your kind reply's.