Question: The following is the piece of code that I am trying to execute

```java
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    InputStream is = this.getResources().openRawResource(R.drawable.cat); 

    Bitmap footbm = BitmapFactory.decodeStream(is);

    temp = new Mat (footbm.getHeight(),footbm.getWidth() , CvType.CV_8UC1);
    Utils.bitmapToMat(footbm, temp);  
    Imgproc.cvtColor(temp, temp, Imgproc.COLOR_RGB2GRAY);  
    Bitmap grayBmp = Bitmap.createBitmap(footbm.getWidth(), footbm.getHeight(), Config.RGB_565);  

    Utils.matToBitmap(temp, grayBmp);  

    ImageView iv = (ImageView) findViewById(R.id.imageView1);
    iv.setImageBitmap(grayBmp); 
}

```

And it gives an error as shown below 

> 
> No implementation found for long org.opencv.core.Mat.n\_Mat(int, int,
>  int) (tried Java\_org\_opencv\_core\_Mat\_n\_1Mat and
>  Java\_org\_opencv\_core\_Mat\_n\_1Mat\_\_III) compile is successful.
> 
> 
> 

I guess that the error is due to this statement.

```
temp = new Mat (footbm.getWidth(),footbm.getHeight() , CvType.CV_8UC1);

```

Kindly suggest how to proceed on this.

Answer: 
You can also add an error message to the model state like:

```
ModelState.AddModelError("Day", "Something is wrong with Day");

```

To bind the above error to a specific property you specify the property name as the first parameter => "Day".
```
in the class model for Register,add
[Required(ErrorMessage = "required")]
public int Day
{
get;
set;
}

     to get [Required(ErrorMessage = "required")] this add namespace 
        using System.ComponentModel.DataAnnotations;  
        in controller,also check if(modelstate.isvalid==true)

```