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".
First you need to specify in your model which fields are required.

```
[Required]
public int? Day { get; set; }

[Required]    
public int? Month { get; set; }

[Required]
public int? Year { get; set; }

```

\*you need to import namespace `System.ComponentModel.DataAnnotations` to get `[Required]`

then in view you need to add the validation message 

```
@Html.TextBoxFor(m => m.Register.Day, new { id = "day_birthdate" })
@Html.ValidationMessageFor(m => m.Register.Day)

@Html.TextBoxFor(m => m.Register.Month, new { id = "month_birthdate"})
@Html.ValidationMessageFor(m => m.Register.Month)

@Html.TextBoxFor(m => m.Register.Year, new { id = "year_birthdate" })
@Html.ValidationMessageFor(m => m.Register.Year)

```

Let me know if it works.