Created
January 15, 2021 07:10
-
-
Save yurafuca/cbf9d9eacc5c3e28ff600e1e0fa63cb1 to your computer and use it in GitHub Desktop.
dct
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var path = @"C:\path\to\lena.bmp"; | |
| var input = Cv2.ImRead(path); | |
| var src = new Mat(size, size, MatType.CV_64FC1); | |
| var dst = new Mat(size, size, MatType.CV_64FC1); | |
| var inputIndexer = input.GetGenericIndexer<Vec3b>(); | |
| var dstIndexer = src.GetGenericIndexer<Vec3d>(); | |
| for (var x = 0; x < size; x++) | |
| { | |
| for (var y = 0; y < size; y++) | |
| { | |
| var color = dstIndexer[y, x]; | |
| color.Item0 = inputIndexer[y, x].Item0 / 256.0; | |
| dstIndexer[y, x] = color; | |
| } | |
| } | |
| Cv2.Dct(src, dst); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment