質問編集履歴
1
追記\(プログラムの変更\)を行いました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
画像が表示されません。
|
test
CHANGED
@@ -117,3 +117,113 @@
|
|
117
117
|
}
|
118
118
|
|
119
119
|
```
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
追記
|
124
|
+
|
125
|
+
clicklistenerを呼び出すアクティビティを消して、Rの定義を忘れていたのでsetContentView(R.layout.activity_main2);を追記するとnullが消え、レイアウトは表示されたんですが、画像が表示されませんでした。
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
```
|
132
|
+
|
133
|
+
public class Main2Activity extends MainActivity {
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
@Override
|
138
|
+
|
139
|
+
public void onCreate(Bundle savedInstanceState) {
|
140
|
+
|
141
|
+
super.onCreate(savedInstanceState);
|
142
|
+
|
143
|
+
setContentView(R.layout.activity_main2);
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
ImageView mImageView;
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
Intent intent = getIntent();
|
152
|
+
|
153
|
+
if(intent == null) {
|
154
|
+
|
155
|
+
Log.e("click", "intentがとれない");
|
156
|
+
|
157
|
+
return;
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
long addr = intent.getLongExtra("myImg", 0);
|
162
|
+
|
163
|
+
Mat image2 = new Mat(addr);
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
Log.i("click", "1");
|
168
|
+
|
169
|
+
int height = image2.height();
|
170
|
+
|
171
|
+
int width = image2.width();
|
172
|
+
|
173
|
+
Mat mOutputFrame = new Mat(height, width, CvType.CV_8UC1);
|
174
|
+
|
175
|
+
Mat src_img_gray = new Mat(height, width, CvType.CV_8UC1);
|
176
|
+
|
177
|
+
Mat image3 = new Mat(height, width, CvType.CV_8UC1);
|
178
|
+
|
179
|
+
Log.i("click", "2");
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
//領域抽出の前処理
|
184
|
+
|
185
|
+
Imgproc.medianBlur(image2, mOutputFrame, 7);
|
186
|
+
|
187
|
+
Imgproc.Canny(mOutputFrame, image3, 80, 100);
|
188
|
+
|
189
|
+
Log.i("click", "3");
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
//bwImage.convertTo(mGr, CvType.CV_RGB2GRAY);
|
194
|
+
|
195
|
+
//salt(image3.getNativeObjAddr(), 2000);
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
Bitmap bitmap= Bitmap.createBitmap(image3.width(), image3.height(), Bitmap.Config.ARGB_8888);
|
200
|
+
|
201
|
+
Utils.matToBitmap(image3, bitmap);// Mat -> Bitmap
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
Log.i("click", "4");
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
mImageView = (ImageView)findViewById(R.id.m_image_view);
|
210
|
+
|
211
|
+
//_cameraBridgeViewBase.setBackgroundColor(Color.GRAY);
|
212
|
+
|
213
|
+
mImageView.setImageBitmap(bitmap); // ImageViewに描画
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
Log.i("click", "finish");
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
public native void salt(long matAddrGray, int nbrElem);
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
```
|