我有一个程序,我在其中调用通知.通知,如果您将其下拉,则启动新活动.
mNotificationManager = (NotificationManager) getSystemService(ns);
int icon = R.drawable.stat_sys_secure_green;
CharSequence tickerText = "Browser Security Enabled";
long when = System.currentTimeMillis();
notification = new Notification(icon, tickerText, when);
Context context = getApplicationContext();
CharSequence contentTitle = "Browser Security";
CharSequence contentText = "Security Vulnerability Detected";
Intent notificationIntent = new Intent(this, PrivacyMessage.class);
//Test Extra
notificationIntent.putExtra("Primary Key", "Primary Text");
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(HELLO_ID, notification);
Run Code Online (Sandbox Code Playgroud)
当我想要刷新辅助活动时,问题会出现在代码中.主要活动应该能够动态地更改其中的额外内容.我尝试通过启动新意图来做到这一点.
CharSequence contentTitle = "Browser Security";
CharSequence contentText = "Test New Notification";
Intent intent = …Run Code Online (Sandbox Code Playgroud) 我正在尝试遮盖框架的某个区域,以便获得形状的均值。我的代码如下:
for h, cnt in enumerate(contours):
mask = np.zeros(source_img.shape, np.uint8)
cv2.drawContours(mask, [cnt], 0, 255, -1)
print mask
print mask.dtype
mean = cv2.mean(source_img, mask=mask)
Run Code Online (Sandbox Code Playgroud)
但是,运行此代码时,我得到了error: (-215) mask.empty() || mask.type() == CV_8U in function mean。
包含的打印语句回来了uint8。蒙版本身的打印会打印出一个非空的numpy数组,其值分别为0和255。关于我要去哪里的问题还有其他想法吗?