Skip to content
Snippets Groups Projects
Commit 3c241b93 authored by Farhan Nabil Suryono's avatar Farhan Nabil Suryono Committed by Johanes Lee
Browse files

Fix/context contour

parent ea6df121
Branches
2 merge requests!60merge: sprint 5 finalization,!59Fix/context contour
...@@ -55,8 +55,6 @@ class ContourOMRHelperTest { ...@@ -55,8 +55,6 @@ class ContourOMRHelperTest {
config.templateMatchingOMRHelperConfig.setTemplate(templateLoader) config.templateMatchingOMRHelperConfig.setTemplate(templateLoader)
helper = ContourOMRHelper(config.contourOMRHelperConfig) helper = ContourOMRHelper(config.contourOMRHelperConfig)
helper.appContext = appContext
} }
} }
......
package com.k2_9.omrekap.utils.omr package com.k2_9.omrekap.utils.omr
import android.content.Context
import android.graphics.Bitmap import android.graphics.Bitmap
import android.util.Log import android.util.Log
import com.k2_9.omrekap.data.configs.omr.ContourOMRHelperConfig import com.k2_9.omrekap.data.configs.omr.ContourOMRHelperConfig
import com.k2_9.omrekap.data.configs.omr.OMRSection import com.k2_9.omrekap.data.configs.omr.OMRSection
import com.k2_9.omrekap.utils.ImageAnnotationHelper import com.k2_9.omrekap.utils.ImageAnnotationHelper
import com.k2_9.omrekap.utils.SaveHelper
import org.opencv.android.Utils import org.opencv.android.Utils
import org.opencv.core.Core import org.opencv.core.Core
import org.opencv.core.CvType import org.opencv.core.CvType
...@@ -28,7 +26,6 @@ import kotlin.math.sin ...@@ -28,7 +26,6 @@ import kotlin.math.sin
class ContourOMRHelper(private val config: ContourOMRHelperConfig) : OMRHelper(config) { class ContourOMRHelper(private val config: ContourOMRHelperConfig) : OMRHelper(config) {
private var currentSectionGray: Mat? = null private var currentSectionGray: Mat? = null
private var currentSectionBinary: Mat? = null private var currentSectionBinary: Mat? = null
public var appContext: Context? = null
/** /**
* Create information object about the contour * Create information object about the contour
...@@ -384,14 +381,6 @@ class ContourOMRHelper(private val config: ContourOMRHelperConfig) : OMRHelper(c ...@@ -384,14 +381,6 @@ class ContourOMRHelper(private val config: ContourOMRHelperConfig) : OMRHelper(c
"ContourOMRHelper", "ContourOMRHelper",
"Completed missing contours, now have ${completedContours.size} contours", "Completed missing contours, now have ${completedContours.size} contours",
) )
val display = currentSectionGray!!.clone()
Imgproc.drawContours(display, completedContours, -1, Scalar(255.0), -1)
val bitmap = Bitmap.createBitmap(display.cols(), display.rows(), Bitmap.Config.ARGB_8888)
Utils.matToBitmap(display, bitmap)
SaveHelper.saveImage(appContext!!, bitmap, "test", "lol.png")
} }
return filteredContours return filteredContours
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment