Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DIP] Added BMP image encoding and decoding instead of opencv and Modify the image container test #186

Merged
merged 48 commits into from
Sep 21, 2023

Conversation

Guan-schoolmate
Copy link
Contributor

[DIP] Added BMP image encoding and decoding.
[tests] Modified tests for image containers, added tests for copy constructs and move constructs.
[examples] Test BMP images by modifying rotation and resize files and replace opencv's imread and imwrite with our imread and imwrite.

Guan-schoolmate and others added 25 commits August 16, 2023 07:51
Copy link
Contributor

@FlagerLee FlagerLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good with only one small problem. @zhanghb97 Any missing?
I'll run your code tomorrow.

examples/ConvOpt/edge-detection.cpp Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/imgcodecs/loadsave.hpp Outdated Show resolved Hide resolved
Copy link
Member

@zhanghb97 zhanghb97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the style uniform:

  • unify filenames in imgcodecs
  • use .h as suffix
  • remove "////////..." in the header of these reused files, which exceeds 80 column limitation.

A Design Point Discussion
Can we implement imread into the image constructor? What is the benefit of designing a separate imread function to build an image container object?

Error Report
Run DIP examples and get the following error:

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)

frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
examples/DIPDialect/rotation2D.cpp Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/imgcodecs/Replenishment.hpp Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/imgcodecs/loadsave.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/imgcodecs/loadsave.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
frontend/Interfaces/buddy/DIP/ImageContainer.h Outdated Show resolved Hide resolved
Copy link
Member

@zhanghb97 zhanghb97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@zhanghb97 zhanghb97 merged commit 830204f into buddy-compiler:main Sep 21, 2023
1 check passed
qzylalala pushed a commit to qzylalala/buddy-mlir that referenced this pull request Oct 30, 2023
* [DIP] Complete the constructor declaration of the image container Img class

* [DIP] Adds definitions for constructor and member functions of the Img class

* [DIP] Add a constructor to the Img class to implement Load image data from OpenCV Mat

* [DIP] Modify the format of the code

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Modify the file format

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Added the main analysis file of bmp image (read header node, read image data)

* [DIP] Added read and save functions for images

* [DIP] Modify the comments of the read and save functions for images

* [tests] Add a test image for the image container TestGrayImage.bmp

* [DIP] Add a data pointer to the img class to access image data

* [tests] Add move constructor test and copy constructor test

* [examples] Add examples of test images YuTu.bmp

* [examples][DIPDialect] replace opencv's imread and imwrite with our imread and imwrite

* [examples][DIPDialect] replace opencv's imread and imwrite with our imread and imwrite

* [examples][DIPDialect] Add the namespace dip to the Img class

* [examples][DIP] Add the namespace dip to the Img class

* [DIP] Example Modify the step setting

* [DIP] Delete the definition of a move construct

* [DIP] Delete some comments

* [DIP] Modify the comments of the file

* [DIP] Modify the grfmt_bmp.hpp file format

* [DIP] Modify the bmp image 32-bit RGB image to grayscale image conversion function

* [DIP] Img container doesn't need dip namespace

* [DIP] _type should be placed after rows and cols to match initialize order.

* [DIP] Modify the channels() function definition

* [DIP] if image decoder doesn't exist throw an error.

* [examples] Test against the old opencv

* [DIP] Remove '_' before variable name

* [DIP] add move constructor

* [DIP] remove the data member variable from the Img container, replacing it with getData()

* [DIP] Remove '_' after function name

* [DIP] unify filenames in imgcodecs,use .h as suffix,remove ////////... in the header of these reused files, which exceeds 80 column limitation.

* [DIP][examples] Remove the type definition in replenishment

* [DIP] Delete the channels member variable of the Img class

* [DIP] Modify the channels() function of the Img class

* [DIP] Modify the constructor of the Img class so that the imread function can pass parameters dynamically

* [DIP] Modify the Img constructor, replacing it with MemRef

---------

Co-authored-by: Guan-schoolmate <guan_stu@bupt.edu.cn>
ShiHaoGao pushed a commit to ShiHaoGao/buddy-mlir that referenced this pull request Oct 18, 2024
* [DIP] Complete the constructor declaration of the image container Img class

* [DIP] Adds definitions for constructor and member functions of the Img class

* [DIP] Add a constructor to the Img class to implement Load image data from OpenCV Mat

* [DIP] Modify the format of the code

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Modify the file format

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Added image encoding and decoding files, modified from opencv

* [DIP] Added the main analysis file of bmp image (read header node, read image data)

* [DIP] Added read and save functions for images

* [DIP] Modify the comments of the read and save functions for images

* [tests] Add a test image for the image container TestGrayImage.bmp

* [DIP] Add a data pointer to the img class to access image data

* [tests] Add move constructor test and copy constructor test

* [examples] Add examples of test images YuTu.bmp

* [examples][DIPDialect] replace opencv's imread and imwrite with our imread and imwrite

* [examples][DIPDialect] replace opencv's imread and imwrite with our imread and imwrite

* [examples][DIPDialect] Add the namespace dip to the Img class

* [examples][DIP] Add the namespace dip to the Img class

* [DIP] Example Modify the step setting

* [DIP] Delete the definition of a move construct

* [DIP] Delete some comments

* [DIP] Modify the comments of the file

* [DIP] Modify the grfmt_bmp.hpp file format

* [DIP] Modify the bmp image 32-bit RGB image to grayscale image conversion function

* [DIP] Img container doesn't need dip namespace

* [DIP] _type should be placed after rows and cols to match initialize order.

* [DIP] Modify the channels() function definition

* [DIP] if image decoder doesn't exist throw an error.

* [examples] Test against the old opencv

* [DIP] Remove '_' before variable name

* [DIP] add move constructor

* [DIP] remove the data member variable from the Img container, replacing it with getData()

* [DIP] Remove '_' after function name

* [DIP] unify filenames in imgcodecs,use .h as suffix,remove ////////... in the header of these reused files, which exceeds 80 column limitation.

* [DIP][examples] Remove the type definition in replenishment

* [DIP] Delete the channels member variable of the Img class

* [DIP] Modify the channels() function of the Img class

* [DIP] Modify the constructor of the Img class so that the imread function can pass parameters dynamically

* [DIP] Modify the Img constructor, replacing it with MemRef

---------

Co-authored-by: Guan-schoolmate <guan_stu@bupt.edu.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants