Randomly samplying a matrix

2 ビュー (過去 30 日間)
fadams18
fadams18 2020 年 7 月 8 日
コメント済み: fadams18 2020 年 7 月 8 日
Im currently modifying an algorithm which randomly samples a given matrix by
% Omega - set of observed entries. Should be linearly indexed.
%
% A - data vector of the form M(Omega)
[m,n] = size(M);
I = randi([0 1],m,n);
Omega = find(I);
A = M(Omega);
I wonder is it possible to replace the omega by a mask image which is made of text intead of randomly generating it.
  2 件のコメント
KSSV
KSSV 2020 年 7 月 8 日
Omega in the above line of codes is a inde, it should be logical/ double. How you can take a text?
fadams18
fadams18 2020 年 7 月 8 日
Thats the problem.
I tried to modify the algorithm by doing this:
Input_Image = double(imread('/home/Desktop/relatedworks/re1.jpg'));
mask = double(imread('/home/Desktop/relatedworks/block_text.bmp'));
mask = mask ./ max(mask(:)); % index matrix of the known elements
X = Input_Image.*mask;
The original code randomly removed entries of the randomly generated matrix M whereas im trying to mask an image with text. The text in this case serves as the missing entries of my image. is there a workaround this?
I tried to replace Omega by mask and A by X. I get this error when i run the algorith
Subscript indices must either be real positive integers or logicals.
Error in mc_nmf (line 65)
Z = zeros(m,n); Z(Omega) = A;

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by