Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

for image 668*1537,among them for 159 different rows are selected to insert new pixel values by retaining original pixel values how to insert this pixel values for selected 159 different rows such that pixles are inserted at those rows

조회 수: 1 (최근 30일)
display of the resultant image is also needed

답변 (1개)

Walter Roberson
Walter Roberson 2015년 11월 16일
MATLAB does not permit numeric arrays with a different number of columns in each row, which would be needed in order to insert new pixels while retaining original pixel values.
  댓글 수: 2
Ram
Ram 2015년 11월 17일
its to be insert pixle vales in some columns of same image for specific rows only
Walter Roberson
Walter Roberson 2015년 11월 17일
We possibly have a communication difficulty. In English, when something is inserted, the object continues to hold everything that it did before and as well holds what was inserted. For example, if you "insert" an '*' into 'hello' then you might get 'h*ello'. If the intention was to instead result in 'h*llo' then in English the term is "overwrite", or you might "assign" data to the locations or "replace" data in the locations. In these situations, you do not "retain the original values", at least not in the original matrix. You might save a copy of the original values elsewhere.
If you want to overwrite (for example) column 7 of rows 19, 20, 85, 111, and 402, all with the value 255, then you can use
column_to_use = 7;
rows_to_overwrite = [19, 20, 85, 111, 402];
newvalue = 255;
TheMatrix(rows_to_overwrite, column_to_use) = newvalue;
I also recommend that you read Linear Indexing and in particular read more about sub2ind()

Community Treasure Hunt

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

Start Hunting!

Translated by