Ask Your Question

50200's profile - activity

2020-02-14 02:03:38 -0600 received badge  Notable Question (source)
2019-09-17 05:03:58 -0600 received badge  Popular Question (source)
2018-09-12 07:16:39 -0600 asked a question How can i save changed data in RecyclerView

How can i save changed data in RecyclerView I am processing an image and getting 'data' from it. Then i show those in Re

2018-09-08 12:57:46 -0600 answered a question Filled circle are not detecting

https://docs.opencv.org/3.4.0/d4/d70/tutorial_hough_circle.html follow this. it may help you

2018-09-07 13:48:01 -0600 edited question RecyclerView and setting data is giving indexoutofbound error

RecyclerView and setting it giving indexoutofbound error I have went through number of these error in stack exchange but

2018-09-07 13:47:56 -0600 edited question RecyclerView and setting data is giving indexoutofbound error

RecyclerView and setting it giving indexoutofbound error I have went through number of these error in stack exchange but

2018-09-07 13:17:29 -0600 asked a question RecyclerView and setting data is giving indexoutofbound error

RecyclerView and setting it giving indexoutofbound error I have went through number of these error in stack exchange but

2018-09-07 05:00:00 -0600 received badge  Enthusiast
2018-09-06 09:11:46 -0600 edited question detect circle is filled or not.

detect circle is filled or not. i am trying to detect if it is filled or not from a small image which i cropped from ano

2018-09-06 09:09:14 -0600 asked a question detect circle is filled or not.

detect circle is filled or not. i am trying to detect if it is filled or not from a small image which i cropped from ano

2018-09-06 04:44:46 -0600 asked a question Image processing in RecyclerView Android

Image processing in RecyclerView Android I am trying to process an image for extracting text and detecting circle (eithe

2018-09-03 08:41:42 -0600 commented answer Detect rectangles in image, crop and save in internal storage

@StevenPuttemans Thank you. its working perfectly now. I am really new at this. I really appreciate all of you for this

2018-09-03 05:31:50 -0600 commented answer Detect rectangles in image, crop and save in internal storage

Thank you a lot for your suggestion. I tried that as you suggested but then it did not detect any contour at all. is the

2018-09-03 05:19:50 -0600 commented answer Detect rectangles in image, crop and save in internal storage

Thank you a lot for your suggestion. I tried that as you suggested but then it did not detect any contour at all. is the

2018-09-03 03:56:04 -0600 marked best answer Detect rectangles in image, crop and save in internal storage

Hi i am working on a small Android project using Java where one of the so many functions is to detect rectangular (contains data) and crop the images into several different images (depend on the rectangular the image contains.) then store the images on internal storage (for other process).

I am very new at openCV. i have not done any openCV project. Is there anyone who can help me to guide how i can achieve this? i found some helps but all of them are in python which i have very less knowledge. Thanks in advance.

i need to crop all the rectangles with the number and dots

can anyone please provide some guidance to do so.. ?

This is what i did so far--

  public class ProcessesdResult extends AppCompatActivity {

   TextView tvProcessedText;
   Bitmap image;
   String photoPath;
   Mat imageMat;
   ImageView ProcessedImage;


   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       OpenCVLoader.initDebug();

       setContentView(R.layout.activity_processesd_result);

       Intent intenttakeattendance = getIntent();
       String fname = intenttakeattendance.getStringExtra("fname");

       String root = Environment.getExternalStorageDirectory().toString();
       File myDir = new File(root);

       photoPath = myDir+"/sams_images/"+ fname;
       BitmapFactory.Options options = new BitmapFactory.Options();
       options.inPreferredConfig = Bitmap.Config.ARGB_8888;
       image = BitmapFactory.decodeFile(photoPath, options);

       ProcessedImage = findViewById(R.id.processedimage);

       // tvProcessedText = findViewById(R.id.tvprocessedtext);
       //imageProcess(image);
       imageCrop(image);
   }


   public void imageCrop(Bitmap bitmap){

       imageMat=new Mat();

       Utils.bitmapToMat(bitmap,imageMat);
       Mat imgSource=imageMat.clone();

       Mat imageHSV = new Mat(imgSource.size(), CvType.CV_8UC4);
       Mat imageBlurr = new Mat(imgSource.size(),CvType.CV_8UC4);
       Mat imageA = new Mat(imgSource.size(), CvType.CV_32F);
       Imgproc.cvtColor(imgSource, imageHSV, Imgproc.COLOR_BGR2GRAY);
       Imgproc.GaussianBlur(imageHSV, imageBlurr, new Size(5,5), 0);
       Imgproc.adaptiveThreshold(imageBlurr, imageA, 255,Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY,7, 5);

       List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
       Imgproc.findContours(imageA, contours, new Mat(), Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);

       Vector<Mat> rectangles = new Vector<Mat>();

       for(int i=0; i< contours.size();i++){
           if (Imgproc.contourArea(contours.get(i)) > 50 )
             {
               Rect rect = Imgproc.boundingRect(contours.get(i));
               if ((rect.height > 30 && rect.height < 120) && (rect.width > 120 && rect.width < 500))
                 {
                    Rect rec = new Rect(rect.x, rect.y, rect.width, rect.height);
                    rectangles.add(new Mat(imgSource, rec));
                    Imgproc.rectangle(imgSource, new Point(rect.x,rect.y), new Point(rect.x+rect.width,rect.y+rect.height),new Scalar(0,0,255));
                 }
            }
       }

       Bitmap analyzed=Bitmap.createBitmap(imgSource.cols(),imgSource.rows(),Bitmap.Config.ARGB_8888);
       Utils.matToBitmap(imgSource,analyzed);

       saveTempImage(analyzed);
       ProcessedImage.setImageBitmap(analyzed);

   }


/*------------------------------------ Store Image -------------------------------------------*/
   public void saveTempImage(Bitmap bitmap) {
        if (isExternalStorageWritable()) {
            saveImage(bitmap);
        }else{
               Toast.makeText(this, "Please provide permission to write on the Storage!", Toast.LENGTH_SHORT).show();
        }
    }

    private void saveImage(Bitmap finalBitmap) {

        String root = Environment.getExternalStorageDirectory().toString();
        File myDir = new File(root + "/sams_images");

        if (! myDir.exists()){
            myDir.mkdir();
           // If you require it to make the entire directory path including parents,
           // use directory.mkdirs(); here instead.
       }

       String  timeStamp = new SimpleDateFormat("yyyyMMdd_HHmm").format(new Date());
       String fname = timeStamp +".jpg";

       File file = new File(myDir, fname);
       if (file.exists()) file.delete ();
       try {
           FileOutputStream out = new FileOutputStream(file);
           finalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
           out.flush();
           out.close();

       } catch (Exception e) {
           e.printStackTrace();
         }
   }

   /* Checks if external storage is available for read ...
(more)
2018-09-03 03:56:04 -0600 received badge  Scholar (source)
2018-09-03 02:49:53 -0600 edited question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher

2018-09-03 02:49:09 -0600 edited question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher

2018-09-03 02:46:17 -0600 edited question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher

2018-09-03 02:43:17 -0600 edited question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher

2018-09-03 02:42:44 -0600 commented question Detect rectangles in image, crop and save in internal storage

@LBerger thank you a lot. I found the solution. but still there is a small problem. I edited the post.

2018-09-03 02:42:01 -0600 edited question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher

2018-09-03 02:40:07 -0600 commented question Detect rectangles in image, crop and save in internal storage

@LBerger thank you a lot. I found the solution. but still there is a small problem. I will post the answer. by tomorrow

2018-09-03 02:23:46 -0600 received badge  Editor (source)
2018-09-03 02:23:46 -0600 edited question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher

2018-09-02 11:30:54 -0600 commented question Detect rectangles in image, crop and save in internal storage

sorry if my question seems that way, i just wanted the steps (algorithm) and even if it means just a list of statement..

2018-09-02 07:23:59 -0600 commented question Detect rectangles in image, crop and save in internal storage

thank you for the suggestion. i tried but did not found any solution that suits my problem. most of the solutions are fo

2018-09-02 07:22:29 -0600 commented question Detect rectangles in image, crop and save in internal storage

thank you for the suggestion. i tried but did not found any solution that suits my problem. mot of the solution is for e

2018-09-02 06:58:44 -0600 asked a question Detect rectangles in image, crop and save in internal storage

Detect rectangles in image, crop and save in internal storage Hi i am working on a small Android project using Java wher