SaashaJoshi / piQture

piQture: A quantum machine learning library for image processing.
https://saashajoshi.github.io/piQture/
Apache License 2.0
15 stars 7 forks source link

Add INEQR image representation method. #46

Closed SaashaJoshi closed 6 months ago

SaashaJoshi commented 6 months ago

Implements INEQR image representation method, which improves upon the existing NEQR method to embed rectangular images.

Reference: [1] N. Jiang and L. Wang, “Quantum image scaling using nearest neighbor interpolation,” Quantum Information Processing, vol. 14, no. 5, pp. 1559–1571, Sep. 2014, doi: https://doi.org/10.1007/s11128-014-0841-8.

Partially addresses #31

SaashaJoshi commented 6 months ago

The above commits make changes to FRQI and NEQR classes as well.

Summary of changes:

  1. Remove the inheritance of NEQR on FRQI.
  2. Addition of a mixin class ImageMixin that implements common/duplicate methods such as pixel_position.
  3. Change to pixel_val abstract method in ImageEmbedding class. This method now takes *args, **kwargs as arguments to provide flexibility for different argument requirements in different child classes.
SaashaJoshi commented 6 months ago

According to the comment, https://github.com/SaashaJoshi/quantum-image-processing/issues/31#issuecomment-1879294067, INEQR is a subset of GQIR representations, since GQIR can represent images of arbitrary dimensions H x W. This behaviour is also reflected in the implementation where,

self.x_coord = int(math.log(img_dims[0], 2)) self.y_coord = int(math.log(img_dims[1], 2))

So, the question is if the implementation should be named and referred to as INEQR or GQIR.

SaashaJoshi commented 6 months ago

Need for different implementations, as described in https://github.com/SaashaJoshi/quantum-image-processing/issues/31#issuecomment-1879454072

Therefore this necessitates the inclusion of logic that determines if the images and the pixel_vals matrix input for INEQR represent a 2^n1 x 2^n2 image. If not, some error should be raised that demands the user use GQIR instead of INEQR.