The Different Format of Date in English

本文介绍了两种主要的日期格式:英国格式为日+月+年,并使用序数词表示日子;美国格式为月+日+年,日子不使用序数词。

    The two different date format is the following:

1.British format: day + month + year,and the day should use ordinal number, For example:
  10th March,2008

2.American format: month + day + year,and the day should not use ordinal number,For example:
  March 10,2008

Homework 4: Binocular Stereo November 6, 2025 Due Date: November 27, by 23:59 Introduction In this project, you will implement a stereo matching algorithm for rectified stereo pairs. For simplicity, you will work under the assumption that the image planes of the two cameras are parallel to each other and to the baseline. The project requires implementing algorithms to compute disparity maps from stereo image pairs and visualizing depth maps. To see examples of disparity maps, run python main.py --tasks 0 to visualize the com￾parison of disparity map generated by cv2.StereoBM and the ground truth. 1 Basic Stereo Matching Algorithm (60 pts.) 1.1 Disparity Map Computation (30 pts.) Implement the function task1 compute disparity map simple() to return the disparity map of a given stereo pair. The function takes the reference image and the second image as inputs, along with the following hyperparameters: • window size: the size of the window used for matching. • disparity range: the minimum and maximum disparity value to search. • matching function: the function used for computing the matching cost. The function should implement a simple window-based stereo matching algorithm, as out￾lined in the Basic Stereo Matching Algorithm section in lecture slides 08: For each pixel in the first (reference) image, examine the corresponding scanline (in our case, the same row) in the second image to search for a best-matching window. The output should be a disparity map with respect to the first (reference) image. Note that you should also manage to record the running time of your code, which should be included in the report. 1.2 Hyperparameter Settings and Report (30 pts.) Set hyperparameters in function task1 simple disparity() to get the best performance. You can try different window sizes, disparity ranges, and matching functions. The comparison of your generated disparity maps and the ground truth maps can be visualized (or saved) by calling function visualize disparity map(). 1 Computer Vision (2025 fall) Homework 4 After finishing the implementation, you can run python main.py --tasks 1 to generate disparity maps with different settings and save them in the output folder. According to the comparison of your disparity maps and ground truth maps under different settings, report and discuss • How does the running time depend on window size, disparity range, and matching function? • Which window size works the best for different matching functions? • What is the maximum disparity range that makes sense for the given stereo pair? • Which matching function may work better for the given stereo pair? With the results above • Discuss the trade-offs between different hyperparameters on quality and time. • Choose the best hyperparameters and show the corresponding disparity map. • Compare the best disparity map with the ground truth map, discuss the differences and limitations of basic stereo matching. 2 Depth from Disparity (25 pts.) 2.1 Pointcloud Visualization (20 pts.) Implement task2 compute depth map() to convert a disparity map to a depth map, and task2 visualize pointcloud() to save the depth map as pointcloud in ply format for visual￾ization (recommended using MeshLab). For depth map computation, follow the Depth from Disparity part in slides 08. You should try to estimate proper depth scaling constants baseline and focal length to get a better performance. The depth of a pixel p can be formulated as: depth(p) = focal length × baseline disparity(p) (1) For pointcloud conversion, the x and y coordinates of a point should match pixel coordinates in the reference image, and the z coordinate shoule be set to the depth value. You should also set the color of the points to the color of the corresponding pixels the reference image. For better performance, you may need to exclude some outliers in the pointcloud. After finishing the implementation, you can run python main.py --tasks 02 to generate a ply file using the disparity map generated with cv2.StereoBM, saved in the output folder. By modifying the settings of the hyperparameters in task1 simple disparity() and run￾ning python main.py --tasks 12, you can generate pointclouds with your implemented stereo matching algorithm under different settings and they will be saved in the output folder. 2 Computer Vision (2025 fall) Homework 4 2.2 Report (5 pts.) Include in your report and compare the results of the pointclouds generated with • disparity map computed using cv2.StereoBM • disparity map computed using your implemented algorithm under optimal settings you found in task 1. 3 Stereo Matching with Dynamic Programming (15 pts.) 3.1 Algorithm Implementation (10 pts.) Incorporate non-local constraints into your algorithm to improve the quality of the disparity map. Specifically, you are to implement the function task3 compute disparity map dp() with dynamic programming algorithms. You may refer to the Stereo Matching with Dynamic Programming section in lecture slides 08. Note that you should also manage to record the running time of your code, which should be included in the report. After finishing the implementation, you can run python main.py --tasks 3 to generate the disparity map and save it in the output folder. You can also run python main.py --tasks 23 to simultaneously generate pointclouds. 3.2 Report (5 pts.) Report the running time, the disparity map, and the pointcloud generated with dynamic programming algorithm. Compare the results with basic stereo matching algorithm. Submission Requirements • Due date of this homework is November 27, by 23:59. Late submission is acceptable but with a penalty of 10% per day. • Zip your code, report, and all the visualization results (including disparity maps and the pointclouds) into a single file named StuID YourName HW4.zip. A wrong naming format may lead to a penalty of 10%. Make sure that the zip file can be unzipped under Windows. • For the code, it should run without errors and can reproduce the results in your report. If you use artificial intelligence tools to help generate codes, explain in your report of (1) how you use them, and (2) the details of implementation in your own words. If your code simultaneously (1) is suspected to be generated by AI tools, and (2) cannot run properly, you may get a penalty of 100%. • For the report, either Chinese or English is acceptable. Please submit a single PDF file, which can be exported from LATEX, Word, MarkDown, or any other text editor. You may get a penalty of 10% if the file format is not correct. 3 Computer Vision (2025 fall) Homework 4 Hints Here are some supplemental materials: • cv2.StereoBM: https://docs.opencv.org/4.x/d9/dba/classcv_1_1StereoBM.html • cv2.StereoBeliefPropagation: https://docs.opencv.org/4.x/de/d7a/classcv_1_1cuda _1_1StereoBeliefPropagation.html
11-28
public class CalendarViewAdapter extends BaseAdapter { private static final String TAG = "MenuSpinnerAdapter"; private final String mButtonNames []; // Text on buttons // Used to define the look of the menu button according to the current view: // Day view: show day of the week + full date underneath // Week view: show the month + year // Month view: show the month + year // Agenda view: show day of the week + full date underneath private int mCurrentMainView; private final LayoutInflater mInflater; // Defines the types of view returned by this spinner private static final int BUTTON_VIEW_TYPE = 0; static final int VIEW_TYPE_NUM = 1; // Increase this if you add more view types public static final int DAY_BUTTON_INDEX = 0; public static final int WEEK_BUTTON_INDEX = 1; public static final int MONTH_BUTTON_INDEX = 2; public static final int AGENDA_BUTTON_INDEX = 3; // The current selected event's time, used to calculate the date and day of the week // for the buttons. private long mMilliTime; private String mTimeZone; private long mTodayJulianDay; private final Context mContext; private final Formatter mFormatter; private final StringBuilder mStringBuilder; private Handler mMidnightHandler = null; // Used to run a time update every midnight private final boolean mShowDate; // Spinner mode indicator (view name or view name with date) // Updates time specific variables (time-zone, today's Julian day). private final Runnable mTimeUpdater = new Runnable() { @Override public void run() { refresh(mContext); } }; public CalendarViewAdapter(Context context, int viewType, boolean showDate) { super(); mMidnightHandler = new Handler(); mCurrentMainView = viewType; mContext = context; mShowDate = showDate; // Initialize mButtonNames = context.getResources().getStringArray(R.array.buttons_list); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mStringBuilder = new StringBuilder(50); mFormatter = new Formatter(mStringBuilder, Locale.getDefault()); // Sets time specific variables and starts a thread for midnight updates if (showDate) { refresh(context); } } // Sets the time zone and today's Julian day to be used by the adapter. // Also, notify listener on the change and resets the midnight update thread. public void refresh(Context context) { mTimeZone = Utils.getTimeZone(context, mTimeUpdater); Time time = new Time(mTimeZone); long now = System.currentTimeMillis(); time.set(now); mTodayJulianDay = Time.getJulianDay(now, time.gmtoff); notifyDataSetChanged(); setMidnightHandler(); } // Sets a thread to run 1 second after midnight and update the current date // This is used to display correctly the date of yesterday/today/tomorrow private void setMidnightHandler() { mMidnightHandler.removeCallbacks(mTimeUpdater); // Set the time updater to run at 1 second after midnight long now = System.currentTimeMillis(); Time time = new Time(mTimeZone); time.set(now); long runInMillis = (24 * 3600 - time.hour * 3600 - time.minute * 60 - time.second + 1) * 1000; mMidnightHandler.postDelayed(mTimeUpdater, runInMillis); } // Stops the midnight update thread, called by the activity when it is paused. public void onPause() { mMidnightHandler.removeCallbacks(mTimeUpdater); } // Returns the amount of buttons in the menu @Override public int getCount() { return mButtonNames.length; } @Override public Object getItem(int position) { if (position < mButtonNames.length) { return mButtonNames[position]; } return null; } @Override public long getItemId(int position) { // Item ID is its location in the list return position; } @Override public boolean hasStableIds() { return false; } @Override public View getView(int position, View convertView, ViewGroup parent) { View v; if (mShowDate) { // Check if can recycle the view if (convertView == null || ((Integer) convertView.getTag()).intValue() != R.layout.actionbar_pulldown_menu_top_button) { v = mInflater.inflate(R.layout.actionbar_pulldown_menu_top_button, parent, false); // Set the tag to make sure you can recycle it when you get it // as a convert view v.setTag(new Integer(R.layout.actionbar_pulldown_menu_top_button)); } else { v = convertView; } TextView weekDay = (TextView) v.findViewById(R.id.top_button_weekday); TextView date = (TextView) v.findViewById(R.id.top_button_date); switch (mCurrentMainView) { case ViewType.DAY: weekDay.setVisibility(View.VISIBLE); weekDay.setText(buildDayOfWeek()); date.setText(buildFullDate()); break; case ViewType.WEEK: if (Utils.getShowWeekNumber(mContext)) { weekDay.setVisibility(View.VISIBLE); weekDay.setText(buildWeekNum()); } else { weekDay.setVisibility(View.GONE); } date.setText(buildMonthYearDate()); break; case ViewType.MONTH: weekDay.setVisibility(View.GONE); date.setText(buildMonthYearDate()); break; case ViewType.AGENDA: weekDay.setVisibility(View.VISIBLE); weekDay.setText(buildDayOfWeek()); date.setText(buildFullDate()); break; default: v = null; break; } } else { if (convertView == null || ((Integer) convertView.getTag()).intValue() != R.layout.actionbar_pulldown_menu_top_button_no_date) { v = mInflater.inflate( R.layout.actionbar_pulldown_menu_top_button_no_date, parent, false); // Set the tag to make sure you can recycle it when you get it // as a convert view v.setTag(new Integer(R.layout.actionbar_pulldown_menu_top_button_no_date)); } else { v = convertView; } TextView title = (TextView) v; switch (mCurrentMainView) { case ViewType.DAY: title.setText(mButtonNames [DAY_BUTTON_INDEX]); break; case ViewType.WEEK: title.setText(mButtonNames [WEEK_BUTTON_INDEX]); break; case ViewType.MONTH: title.setText(mButtonNames [MONTH_BUTTON_INDEX]); break; case ViewType.AGENDA: title.setText(mButtonNames [AGENDA_BUTTON_INDEX]); break; default: v = null; break; } } return v; } @Override public int getItemViewType(int position) { // Only one kind of view is used return BUTTON_VIEW_TYPE; } @Override public int getViewTypeCount() { return VIEW_TYPE_NUM; } @Override public boolean isEmpty() { return (mButtonNames.length == 0); } @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = mInflater.inflate(R.layout.actionbar_pulldown_menu_button, parent, false); TextView viewType = (TextView)v.findViewById(R.id.button_view); TextView date = (TextView)v.findViewById(R.id.button_date); switch (position) { case DAY_BUTTON_INDEX: viewType.setText(mButtonNames [DAY_BUTTON_INDEX]); if (mShowDate) { date.setText(buildMonthDayDate()); } break; case WEEK_BUTTON_INDEX: viewType.setText(mButtonNames [WEEK_BUTTON_INDEX]); if (mShowDate) { date.setText(buildWeekDate()); } break; case MONTH_BUTTON_INDEX: viewType.setText(mButtonNames [MONTH_BUTTON_INDEX]); if (mShowDate) { date.setText(buildMonthDate()); } break; case AGENDA_BUTTON_INDEX: viewType.setText(mButtonNames [AGENDA_BUTTON_INDEX]); if (mShowDate) { date.setText(buildMonthDayDate()); } break; default: v = convertView; break; } return v; } // Updates the current viewType // Used to match the label on the menu button with the calendar view public void setMainView(int viewType) { mCurrentMainView = viewType; notifyDataSetChanged(); } // Update the date that is displayed on buttons // Used when the user selects a new day/week/month to watch public void setTime(long time) { mMilliTime = time; notifyDataSetChanged(); } // Builds a string with the day of the week and the word yesterday/today/tomorrow // before it if applicable. private String buildDayOfWeek() { Time t = new Time(mTimeZone); t.set(mMilliTime); long julianDay = Time.getJulianDay(mMilliTime,t.gmtoff); String dayOfWeek = null; mStringBuilder.setLength(0); if (julianDay == mTodayJulianDay) { dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay - 1) { dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay + 1) { dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else { dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString(); } return dayOfWeek.toUpperCase(); } // Builds strings with different formats: // Full date: Month,day Year // Month year // Month day // Month // Week: month day-day or month day - month day private String buildFullDate() { mStringBuilder.setLength(0); String date = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR, mTimeZone).toString(); return date; } private String buildMonthYearDate() { mStringBuilder.setLength(0); String date = DateUtils.formatDateRange( mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_MONTH_DAY | DateUtils.FORMAT_SHOW_YEAR, mTimeZone).toString(); return date; } private String buildMonthDayDate() { mStringBuilder.setLength(0); String date = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR, mTimeZone).toString(); return date; } private String buildMonthDate() { mStringBuilder.setLength(0); String date = DateUtils.formatDateRange( mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_NO_MONTH_DAY, mTimeZone).toString(); return date; } private String buildWeekDate() { // Calculate the start of the week, taking into account the "first day of the week" // setting. Time t = new Time(mTimeZone); t.set(mMilliTime); int firstDayOfWeek = Utils.getFirstDayOfWeek(mContext); int dayOfWeek = t.weekDay; int diff = dayOfWeek - firstDayOfWeek; if (diff != 0) { if (diff < 0) { diff += 7; } t.monthDay -= diff; t.normalize(true /* ignore isDst */); } long weekStartTime = t.toMillis(true); // The end of the week is 6 days after the start of the week long weekEndTime = weekStartTime + DateUtils.WEEK_IN_MILLIS - DateUtils.DAY_IN_MILLIS; // If week start and end is in 2 different months, use short months names Time t1 = new Time(mTimeZone); t.set(weekEndTime); int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR; if (t.month != t1.month) { flags |= DateUtils.FORMAT_ABBREV_MONTH; } mStringBuilder.setLength(0); String date = DateUtils.formatDateRange(mContext, mFormatter, weekStartTime, weekEndTime, flags, mTimeZone).toString(); return date; } private String buildWeekNum() { int week = Utils.getWeekNumberFromTime(mMilliTime, mContext); return mContext.getResources().getQuantityString(R.plurals.weekN, week, week); } }为什么top_button_date的初始值被设为January 2010
08-15
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值