下面的JavaScript会导致某些文字在网页上闪烁。当我在Blogger上使用锚标记时,它只是像链接一样,不会闪烁。如果它不是锚标记,它将闪烁。有没有办法在Blogger上解决这个问题?
Mat frame;
Mat back;
Mat fore;
Mat temp;
Mat prevImage;
Mat currImage;
// for floodfill
Point seed = Point(0,0);
VideoCapture cap("./Sequence2/Sequence_03_%03d.jpg");
// Background subtraction
BackgroundSubtractorMOG2 bg;
bg.set("nmixtures",5);
bg.set("detectShadows", true);
bg.set("fTau", 0.5);
//
bool foundpoints = false;
vector<uchar> status, err;
// Blob Detector
SimpleBlobDetector::Params params;
//params.filterByColor = true;
//params.blobColor = 255; // use if bitwise not statement used
// // Filter by Area.
params.filterByArea = true; //size
params.minArea = 25;
params.maxArea = 300;
params.filterByCircularity = true; // circle or not
params.minCircularity = 0.15;
params.filterByConvexity = true; // closed or not
params.minConvexity = 0.92;
params.filterByInertia = true; // elongated or not
params.minInertiaRatio = 0.40;
SimpleBlobDetector detector(params);
//
std::vector<std::vector<Point> > contours;
std::vector<KeyPoint> keypoints;
std::vector<Point2f> pKeypoints, prevKeypoints;
namedWindow("Video");
//namedWindow("Background");
for (int i = 0; i < 623; i++) {
file << "./Output3/image" << i << ".jpg";
cap >> frame;
// CONVERT TO GRAY
cvtColor(frame, temp, CV_RGB2GRAY);
//adaptiveThreshold(frame,temp,1,ADAPTIVE_THRESH_MEAN_C,THRESH_BINARY,3,1);
bg.operator ()(temp,fore);
//bg.getBackgroundImage(back);
// THREHOLD THE IMAGE
threshold(fore,fore,80,150,THRESH_TOZERO);
erode(fore,fore,cv::Mat());
dilate(fore,fore,cv::Mat());
findContours(fore,contours,CV_RETR_EXTERNAL,CV_CHAIN_APPROX_NONE);
// REMOVE SOME NOISE
cv::floodFill(fore, seed,(255));
erode(fore,fore,cv::Mat());
dilate(fore,fore,cv::Mat());
//bitwise_not(fore,fore);
erode(fore,fore,cv::Mat());
dilate(fore,fore,cv::Mat());
detector.detect(fore, keypoints);
//std::cout << keypoints.size() << "\n";
if (keypoints.size() > 0){
if (foundpoints == false)
foundpoints = true;
else{
cv::Size winsize = fore.size();
KeyPoint::convert(keypoints,pKeypoints);
// std::cout << pKeypoints.size() << " , " << prevKeypoints.size() << " , " << prevImage.depth() << " , "<< fore.depth();
calcOpticalFlowPyrLK(prevImage,fore,prevKeypoints,pKeypoints,status,err,winsize);
prevImage.pop_back();
}
prevImage.push_back(fore);
KeyPoint::convert(keypoints,prevKeypoints);
}
imshow("Frame",fore); // frame
// imshow("Background",back);
if(cv::waitKey(30) >= 0) break;
imwrite(file.str(), fore);
file.str("");
}
答案 0 :(得分:1)
function blinker() {
if (document.getElementById("blink")) {
var d = document.getElementById("blink");
d.style.color = (d.style.color == 'red' ? 'white' : 'red');
setTimeout('blinker()', 500);
}
}
blinker();
<a href="https://www.google.com/" id="blink">GOOGLE</a>
答案 1 :(得分:0)
<div id="blink"><a href="www.google.com">GOOGLE</a></div>
答案 2 :(得分:0)
<script type="text/javascript"> function blinker() {
if(document.getElementById("blink"))
{
var d = document.getElementById("blink") ;
d.style.color= (d.style.color=='red'?'white':'red');
setTimeout('blinker()', 500);
} } </script>
<body onload="blinker();">
<div id="blink"> <a href="http://www.google.com">GOOGLE</a></div> </body>
基本上,您需要添加一个href元素。
答案 3 :(得分:0)
也许试试这个。它使用JavaScript来处理div链接。看起来像StackOverflow阻塞,这是可以理解的。它应该仍适用于其他页面。但是请注意,如果用户将鼠标悬停在其上方,用户将看不到对方的内容,并且光标不会更改以指示它是可点击的。
function blinker() {
if (document.getElementById("blink")) {
var d = document.getElementById("blink");
d.style.color = (d.style.color == 'red' ? 'white' : 'red');
setTimeout('blinker()', 500);
}
}
function goto(page) {
document.location = page;
}
blinker();
<div onclick="goto('https://www.google.com/')" id="blink">GOOGLE</div>
答案 4 :(得分:0)
终于找到了自己的答案
<script type="text/javascript">
function blinker()
{
if(document.getElementById("blink"))
{
var d = document.getElementById("blink") ;
d.style.color= (d.style.color=='red'?'white':'red');
setTimeout('blinker()', 500);
}
}
</script>
<body onload="blinker();">
<a href="http://www.google.com"><div id="blink">GOOGLE</div></a>
</body>
感谢大家的帮助