From the course: Code Clinic: Clojure

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Extending the comparison

Extending the comparison - Clojure Tutorial

From the course: Code Clinic: Clojure

Start my 1-month free trial

Extending the comparison

- [Instructor] In this video, we'll implement the algorithm that finds the best possible match between two images. We need to check if the cropped image is a horizontal flip of the original image, so first I'll implement a function called horizontal flip. I'll make this take a mat object as its parameter. Now I'll create a let binding. First, I'll call get image meta on the mat object, and I'll destructure this using keys into each of rows, cols, and type. Next, I'll create a new empty matrix called result mat using the mat constructor and passing it the rows, cols, and type from above. In the let body, I'll use the core classes flip static method to flip the input matrix and store it in the result matrix. Next I'll pass it the value one which is used for a horizontal flip. This function returns nil and fills the result matrix with the values. So now I'll put result matrix here so that our function returns it. With this in place, I'm ready to write our function, called best match…

Contents